enable changing debug and prefix by outside callers

This commit is contained in:
brent s. 2021-03-27 10:29:41 -04:00
parent 80985d1084
commit 0887f0c76e
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
6 changed files with 11 additions and 11 deletions

View File

@ -113,7 +113,7 @@ func GetLogger(enableDebug bool, prefix string, logpaths ...string) (logger Logg


logger.Setup() logger.Setup()
if prefix != "\x00" { if prefix != "\x00" {
logger.setPrefix(prefix) logger.SetPrefix(prefix)
} }


logger.Info("logger initialized of type %T with prefix %v", logger, logger.GetPrefix()) logger.Info("logger initialized of type %T with prefix %v", logger, logger.GetPrefix())

View File

@ -35,11 +35,11 @@ func (l *FileLogger) GetPrefix() string {
return l.Prefix return l.Prefix
} }


func (l *FileLogger) doDebug(d bool) { func (l *FileLogger) DoDebug(d bool) {
l.EnableDebug = d l.EnableDebug = d
} }


func (l *FileLogger) setPrefix(prefix string) { func (l *FileLogger) SetPrefix(prefix string) {
l.Prefix = prefix l.Prefix = prefix
l.Logger.SetPrefix(prefix) l.Logger.SetPrefix(prefix)
} }

View File

@ -18,11 +18,11 @@ func (l *StdLogger) Shutdown() {


} }


func (l *StdLogger) doDebug(d bool) { func (l *StdLogger) DoDebug(d bool) {
l.EnableDebug = d l.EnableDebug = d
} }


func (l *StdLogger) setPrefix(prefix string) { func (l *StdLogger) SetPrefix(prefix string) {
l.Prefix = prefix l.Prefix = prefix
l.Logger.SetPrefix(prefix) l.Logger.SetPrefix(prefix)
} }

View File

@ -21,11 +21,11 @@ func (l *SystemDLogger) Shutdown() {


} }


func (l *SystemDLogger) doDebug(d bool) { func (l *SystemDLogger) DoDebug(d bool) {
l.EnableDebug = d l.EnableDebug = d
} }


func (l *SystemDLogger) setPrefix(prefix string) { func (l *SystemDLogger) SetPrefix(prefix string) {
l.Prefix = prefix l.Prefix = prefix
} }



View File

@ -49,11 +49,11 @@ func (l *SyslogLogger) Shutdown() {


} }


func (l *SyslogLogger) doDebug(d bool) { func (l *SyslogLogger) DoDebug(d bool) {
l.EnableDebug = d l.EnableDebug = d
} }


func (l *SyslogLogger) setPrefix(prefix string) { func (l *SyslogLogger) SetPrefix(prefix string) {
l.Prefix = prefix l.Prefix = prefix
l.Setup() l.Setup()
} }

View File

@ -15,8 +15,8 @@ type Logger interface {
Info(string, ...interface{}) error Info(string, ...interface{}) error
Notice(string, ...interface{}) error Notice(string, ...interface{}) error
Warning(string, ...interface{}) error Warning(string, ...interface{}) error
doDebug(bool) DoDebug(bool)
setPrefix(string) SetPrefix(string)
GetPrefix() string GetPrefix() string
Setup() Setup()
Shutdown() Shutdown()