Adding GetDebug method to loggers.

This commit is contained in:
2022-09-07 06:03:28 -04:00
parent a2a849600b
commit a445a51c0d
9 changed files with 141 additions and 83 deletions

View File

@@ -1,11 +1,11 @@
package logging
import (
`errors`
`fmt`
`sync`
"errors"
"fmt"
"sync"
`r00t2.io/goutils/multierr`
"r00t2.io/goutils/multierr"
)
// Setup sets up/configures a MultiLogger (and all its MultiLogger.Loggers) and prepares it for use.
@@ -67,8 +67,8 @@ func (m *MultiLogger) Shutdown() (err error) {
}
/*
GetPrefix returns the prefix used by this MultiLogger (and all its MultiLogger.Loggers).
err will always be nil; it's there for interface-compat.
GetPrefix returns the prefix used by this MultiLogger (and all its MultiLogger.Loggers).
err will always be nil; it's there for interface-compat.
*/
func (m *MultiLogger) GetPrefix() (prefix string, err error) {
@@ -79,10 +79,10 @@ func (m *MultiLogger) GetPrefix() (prefix string, err error) {
}
/*
DoDebug sets the debug state of this MultiLogger (and all its MultiLogger.Loggers).
Note that this merely acts as a *safety filter* for debug messages to avoid sensitive information being written to the log.
DoDebug sets the debug state of this MultiLogger (and all its MultiLogger.Loggers).
Note that this merely acts as a *safety filter* for debug messages to avoid sensitive information being written to the log.
If you had a logger-specific EnableDebug set, you will need to re-set it to your desired state after running this method.
If you had a logger-specific EnableDebug set, you will need to re-set it to your desired state after running this method.
*/
func (m *MultiLogger) DoDebug(d bool) (err error) {
@@ -114,10 +114,18 @@ func (m *MultiLogger) DoDebug(d bool) (err error) {
return
}
/*
SetPrefix sets the prefix for this MultiLogger (and all its MultiLogger.Loggers).
// GetDebug returns the debug status of this MultiLogger.
func (m *MultiLogger) GetDebug() (d bool) {
If you had a logger-specific Prefix set, you will need to re-set it to your desired prefix after running this method.
d = m.EnableDebug
return
}
/*
SetPrefix sets the prefix for this MultiLogger (and all its MultiLogger.Loggers).
If you had a logger-specific Prefix set, you will need to re-set it to your desired prefix after running this method.
*/
func (m *MultiLogger) SetPrefix(prefix string) (err error) {