Skip to content

Commit fa393bb

Browse files
authored
Merge pull request #32480 from vespa-engine/arnej/logfmt-show-all-levels
vespa-logfmt now shows all levels by default;
2 parents 3e66346 + 37c21f9 commit fa393bb

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

client/go/internal/admin/vespa-wrapper/logfmt/levelflags.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ func defaultLevelFlags() map[string]bool {
2121
"error": true,
2222
"warning": true,
2323
"info": true,
24-
"config": false,
25-
"event": false,
26-
"debug": false,
27-
"spam": false,
24+
"config": true,
25+
"event": true,
26+
"debug": true,
27+
"spam": true,
2828
}
2929
}
3030

@@ -68,5 +68,7 @@ func (v *flagValueForLevel) unchanged() bool {
6868
}
6969

7070
func (v *flagValueForLevel) Set(val string) error {
71-
return applyPlusMinus(val, v)
71+
err := applyPlusMinus(val, v)
72+
v.changed = true
73+
return err
7274
}

client/go/internal/admin/vespa-wrapper/logfmt/levelflags_test.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,19 @@ func TestLevelFlags(t *testing.T) {
3737
t.Fail()
3838
}
3939
}
40-
check(" +fatal +error +warning +info -config -event -debug -spam")
40+
check(" +fatal +error +warning +info +config +event +debug +spam")
4141
check(" -fatal -error -warning -info -config -event -debug -spam", "-all")
4242
check(" +fatal +error +warning +info +config +event +debug +spam", "all")
4343
check(" +fatal +error +warning +info +config +event +debug +spam", "+all")
4444
check(" -fatal -error -warning -info -config -event +debug -spam", "debug")
4545
check(" +fatal +error +warning +info +config +event +debug -spam", "all-spam")
4646
check(" +fatal +error +warning +info +config +event +debug -spam", "all", "-spam")
47-
check(" +fatal +error +warning -info -config +event -debug -spam", "+event", "-info")
48-
check(" +fatal +error -warning -info -config +event -debug -spam", "+event,-info,-warning,config")
49-
check(" +fatal +error -warning -info +config +event -debug -spam", "+event,-info,-warning,+config")
50-
check(" +fatal +error -warning -info +config +event -debug -spam", "+event,-info", "-warning,+config")
51-
check(" -fatal -error -warning -info +config -event -debug -spam", "+event", "-info", "-warning", "config")
47+
check(" +fatal +error +warning -info +config +event +debug +spam", "+event", "-info")
48+
check(" +fatal +error -warning -info -config +event +debug +spam", "+event,-info,-warning,config")
49+
check(" +fatal +error -warning -info +config +event +debug +spam", "+event,-info,-warning,+config")
50+
check(" +fatal +error -warning -info +config +event +debug +spam", "+event,-info", "-warning,+config")
51+
check(" +fatal +error -warning -info +config +event +debug +spam", "+event", "-info", "-warning", "config")
52+
check(" -fatal +error -warning +info -config -event +debug -spam", "info", "debug", "error")
5253
check = func(expectErr string, texts ...string) {
5354
var target flagValueForLevel
5455
target.levels = defaultLevelFlags()

client/go/internal/admin/vespa-wrapper/logfmt/showflags.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,7 @@ func (v *flagValueForShow) unchanged() bool {
7272
}
7373

7474
func (v *flagValueForShow) Set(val string) error {
75-
return applyPlusMinus(val, v)
75+
err := applyPlusMinus(val, v)
76+
v.changed = true
77+
return err
7678
}

client/go/internal/admin/vespa-wrapper/logfmt/showflags_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ func TestShowFlags(t *testing.T) {
3737
check(" +time -fmttime +msecs -usecs +host +level -pid -service +component +message", "+host,-fmttime,-service,pid")
3838
check(" +time -fmttime +msecs -usecs +host +level +pid -service +component +message", "+host,-fmttime,-service,+pid")
3939
check(" +time -fmttime +msecs -usecs +host +level +pid -service +component +message", "+host,-fmttime", "-service,+pid")
40-
check(" -time -fmttime -msecs -usecs -host -level +pid -service -component -message", "+host", "-fmttime", "-service", "pid")
40+
check(" +time -fmttime +msecs -usecs +host +level +pid -service +component +message", "+host", "-fmttime", "-service", "pid")
41+
check(" -time -fmttime -msecs -usecs +host -level +pid -service +component -message", "host", "component", "pid")
4142
check = func(expectErr string, texts ...string) {
4243
var target flagValueForShow
4344
target.shown = defaultShowFlags()

0 commit comments

Comments
 (0)