Last active
August 29, 2015 14:12
-
-
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/.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum EchoComponent { | |
case Datetime(format: String) | |
case Flag(flags: [EchoLevel: EchoFlag]) | |
case Filename | |
case Function | |
case Line | |
case Message | |
case Separator(String) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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