Skip to content

Instantly share code, notes, and snippets.

@clmntcrl
Last active August 29, 2015 14:12
Show Gist options
  • Save clmntcrl/64681bfaad3760453d8b to your computer and use it in GitHub Desktop.
Save clmntcrl/64681bfaad3760453d8b to your computer and use it in GitHub Desktop.
Building Echo customizable log format #4. Full post: http://clmntcrl.io/blog/building-echo-customizable-log-format/.
enum EchoComponent {
case Datetime(format: String)
case Flag(flags: [EchoLevel: EchoFlag])
case Filename
case Function
case Line
case Message
case Separator(String)
}
struct Echo {
var format: [EchoComponent] = [
.Flag(flags: [.Trace: "๐Ÿ’Š", .Debug: "โ˜•๏ธ", .Info: "๐Ÿ’ก", .Warn: "โš ๏ธ", .Error: "โŒ", .Fatal: "๐Ÿ’ฃ", .Off: "๐Ÿ˜ถ"]),
.Separator(" ["),
.Datetime(format: "HH:mm:ss.SSS"),
.Separator("] ["),
.Filename,
.Separator(":"),
.Line,
.Separator("] "),
.Message
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment