mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
40 lines
665 B
Swift
40 lines
665 B
Swift
import Foundation
|
|
import Rainbow
|
|
|
|
struct Logger {
|
|
|
|
// MARK: - Properties
|
|
|
|
let isQuiet: Bool
|
|
let isColored: Bool
|
|
|
|
// MARK: - Initializers
|
|
|
|
init(isQuiet: Bool = false, isColored: Bool = true) {
|
|
self.isQuiet = isQuiet
|
|
self.isColored = isColored
|
|
}
|
|
|
|
// MARK: - Logging
|
|
|
|
func error(_ message: String) {
|
|
print(isColored ? message.red : message)
|
|
}
|
|
|
|
func info(_ message: String) {
|
|
if isQuiet {
|
|
return
|
|
}
|
|
|
|
print(message)
|
|
}
|
|
|
|
func success(_ message: String) {
|
|
if isQuiet {
|
|
return
|
|
}
|
|
|
|
print(isColored ? message.green : message)
|
|
}
|
|
}
|