Logging: implement trace level
This commit is contained in:
parent
e668e62018
commit
af1e3f103a
|
@ -23,6 +23,10 @@ func argParse() {
|
|||
printUsage()
|
||||
case "--genconfig":
|
||||
GenConfig = true
|
||||
case "--debug", "-v",
|
||||
forceDebug = true
|
||||
case "--trace", "-vv",
|
||||
forceTrace = true
|
||||
case "--nocolor":
|
||||
noColorForce = true
|
||||
case "--banner":
|
||||
|
|
|
@ -25,7 +25,9 @@ var (
|
|||
|
||||
// exported generic vars
|
||||
var (
|
||||
// Debug is the value of our debug on/off toggle as per the current configuration.
|
||||
// Trace is the value of our trace (extra verbose) on/off toggle as per the current configuration.
|
||||
Trace bool
|
||||
// Debug is the value of our debug (verbose) on/off toggle as per the current configuration.
|
||||
Debug bool
|
||||
// Filename returns the current location of our toml config file.
|
||||
Filename string
|
||||
|
@ -142,6 +144,7 @@ func processOpts() {
|
|||
boolOpt := map[string]*bool{
|
||||
"http.use_unix_socket": &UseUnixSocket,
|
||||
"logger.debug": &Debug,
|
||||
"logger.trace": &Trace,
|
||||
"performance.restrict_concurrency": &RestrictConcurrency,
|
||||
"logger.nocolor": &NoColor,
|
||||
}
|
||||
|
@ -179,7 +182,10 @@ func associateExportedVariables() {
|
|||
}
|
||||
}
|
||||
|
||||
if Debug {
|
||||
if Debug || forceDebug {
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
}
|
||||
if Trace || forceTrace {
|
||||
zerolog.SetGlobalLevel(zerolog.TraceLevel)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ var (
|
|||
var defOpts = map[string]map[string]interface{}{
|
||||
"logger": {
|
||||
"debug": true,
|
||||
"trace": false,
|
||||
"directory": deflogdir,
|
||||
"nocolor": defNoColor,
|
||||
"use_date_filename": true,
|
||||
|
|
|
@ -44,7 +44,7 @@ func hellPot(ctx *fasthttp.RequestCtx) {
|
|||
wn, err = heffalump.DefaultHeffalump.WriteHell(bw)
|
||||
n += wn
|
||||
if err != nil {
|
||||
slog.Debug().Err(err).Msg("END_ON_ERR")
|
||||
slog.Trace().Err(err).Msg("END_ON_ERR")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue