@@ -1852,14 +1852,19 @@ func (e *Entry) Discard() *Entry {
18521852
18531853var notTest = true
18541854
1855+ // TimeFormatUnixWithMs defines the message key that makes message fields can be customized.
1856+ var MessageKey = "message"
1857+
18551858// Msg sends the entry with msg added as the message field if not empty.
18561859func (e * Entry ) Msg (msg string ) {
18571860 if e == nil {
18581861 return
18591862 }
18601863
18611864 if msg != "" {
1862- e .buf = append (e .buf , ",\" message\" :\" " ... )
1865+ e .buf = append (e .buf , ",\" " ... )
1866+ e .buf = append (e .buf , MessageKey ... )
1867+ e .buf = append (e .buf , "\" :\" " ... )
18631868 e .string (msg )
18641869 e .buf = append (e .buf , "\" }\n " ... )
18651870 } else {
@@ -1900,7 +1905,9 @@ func (e *Entry) Msgf(format string, v ...any) {
19001905
19011906 b := bbpool .Get ().(* bb )
19021907 b .B = b .B [:0 ]
1903- e .buf = append (e .buf , ",\" message\" :\" " ... )
1908+ e .buf = append (e .buf , ",\" " ... )
1909+ e .buf = append (e .buf , MessageKey ... )
1910+ e .buf = append (e .buf , "\" :\" " ... )
19041911 fmt .Fprintf (b , format , v ... )
19051912 e .bytes (b .B )
19061913 e .buf = append (e .buf , '"' )
@@ -1918,7 +1925,9 @@ func (e *Entry) Msgs(args ...any) {
19181925
19191926 b := bbpool .Get ().(* bb )
19201927 b .B = b .B [:0 ]
1921- e .buf = append (e .buf , ",\" message\" :\" " ... )
1928+ e .buf = append (e .buf , ",\" " ... )
1929+ e .buf = append (e .buf , MessageKey ... )
1930+ e .buf = append (e .buf , "\" :\" " ... )
19221931 fmt .Fprint (b , args ... )
19231932 e .bytes (b .B )
19241933 e .buf = append (e .buf , '"' )
0 commit comments