@@ -27,7 +27,35 @@ func (o Options) Run() error {
27
27
l .SetPrefix (o .Prefix )
28
28
l .SetLevel (- math .MaxInt32 ) // log all levels
29
29
l .SetReportTimestamp (o .Time )
30
- l .SetTimeFormat (o .TimeFormat )
30
+
31
+ timeFormats := map [string ]string {
32
+ "layout" : "01/02 03:04:05PM '06 -0700" ,
33
+ "ansic" : "Mon Jan _2 15:04:05 2006" ,
34
+ "unixdate" : "Mon Jan _2 15:04:05 MST 2006" ,
35
+ "rubydate" : "Mon Jan 02 15:04:05 -0700 2006" ,
36
+ "rfc822" : "02 Jan 06 15:04 MST" ,
37
+ "rfc822z" : "02 Jan 06 15:04 -0700" ,
38
+ "rfc850" : "Monday, 02-Jan-06 15:04:05 MST" ,
39
+ "rfc1123" : "Mon, 02 Jan 2006 15:04:05 MST" ,
40
+ "rfc1123z" : "Mon, 02 Jan 2006 15:04:05 -0700" ,
41
+ "rfc3339" : "2006-01-02T15:04:05Z07:00" ,
42
+ "rfc3339nano" : "2006-01-02T15:04:05.999999999Z07:00" ,
43
+ "kitchen" : "3:04PM" ,
44
+ "stamp" : "Jan _2 15:04:05" ,
45
+ "stampmilli" : "Jan _2 15:04:05.000" ,
46
+ "stampmicro" : "Jan _2 15:04:05.000000" ,
47
+ "stampnano" : "Jan _2 15:04:05.000000000" ,
48
+ "datetime" : "2006-01-02 15:04:05" ,
49
+ "dateonly" : "2006-01-02" ,
50
+ "timeonly" : "15:04:05" ,
51
+ }
52
+
53
+ tf , ok := timeFormats [strings .ToLower (o .TimeFormat )]
54
+ if ok {
55
+ l .SetTimeFormat (tf )
56
+ } else {
57
+ l .SetTimeFormat (o .TimeFormat )
58
+ }
31
59
32
60
st := log .DefaultStyles ()
33
61
defaultColors := map [log.Level ]lipgloss.Color {
0 commit comments