@@ -100,6 +100,11 @@ type Options struct {
100
100
// details, see docs for Go's time.Layout.
101
101
TimestampFormat string
102
102
103
+ // LogInfoLevel tells funcr what key to use to log the info level.
104
+ // If not specified, the info level will be logged as "level".
105
+ // If this is set to "", the info level will not be logged at all.
106
+ LogInfoLevel * string
107
+
103
108
// Verbosity tells funcr which V logs to produce. Higher values enable
104
109
// more logs. Info logs at or below this level will be written, while logs
105
110
// above this level will be discarded.
@@ -213,6 +218,10 @@ func newFormatter(opts Options, outfmt outputFormat) Formatter {
213
218
if opts .MaxLogDepth == 0 {
214
219
opts .MaxLogDepth = defaultMaxLogDepth
215
220
}
221
+ if opts .LogInfoLevel == nil {
222
+ opts .LogInfoLevel = new (string )
223
+ * opts .LogInfoLevel = "level"
224
+ }
216
225
f := Formatter {
217
226
outputFormat : outfmt ,
218
227
prefix : "" ,
@@ -835,7 +844,10 @@ func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, args
835
844
if policy := f .opts .LogCaller ; policy == All || policy == Info {
836
845
args = append (args , "caller" , f .caller ())
837
846
}
838
- args = append (args , "level" , level , "msg" , msg )
847
+ if key := * f .opts .LogInfoLevel ; key != "" {
848
+ args = append (args , key , level )
849
+ }
850
+ args = append (args , "msg" , msg )
839
851
return prefix , f .render (args , kvList )
840
852
}
841
853
0 commit comments