build/log: support parsing global+subsystem levels

This makes it possible to specify both a global+subsystem loglevels,
like:
--debuglevel=debug,PEER=info,SRVR=trace
This commit is contained in:
Johan T. Halseth
2020-11-16 11:22:57 +01:00
parent fcf2e7f687
commit c1d423dc07
2 changed files with 32 additions and 10 deletions

View File

@@ -75,6 +75,20 @@ func TestParseAndSetDebugLevels(t *testing.T) {
"SRVR": "debug",
},
},
{
name: "valid global+subsystem debug level",
debugLevel: "trace,PEER=info,SRVR=debug",
expGlobal: "trace",
expSubLevels: map[string]string{
"PEER": "info",
"SRVR": "debug",
},
},
{
name: "invalid global+subsystem debug level",
debugLevel: "PEER=info,debug,SRVR=debug",
expErr: "invalid",
},
}
for _, test := range testCases {