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

@@ -6,7 +6,7 @@ import (
)
/*
Logger is one of the various loggers offered by this module.
Logger is one of the various loggers offered by this module.
*/
type Logger interface {
Alert(s string, v ...interface{}) (err error)
@@ -18,6 +18,7 @@ type Logger interface {
Notice(s string, v ...interface{}) (err error)
Warning(s string, v ...interface{}) (err error)
DoDebug(d bool) (err error)
GetDebug() (d bool)
SetPrefix(p string) (err error)
GetPrefix() (p string, err error)
Setup() (err error)
@@ -25,8 +26,8 @@ type Logger interface {
}
/*
StdLogger uses the log package in stdlib to perform all logging. The default is to write to STDOUT.
If you wish to modify the underling log.Logger object, you can access it directly via StdLogger.Logger.
StdLogger uses the log package in stdlib to perform all logging. The default is to write to STDOUT.
If you wish to modify the underling log.Logger object, you can access it directly via StdLogger.Logger.
*/
type StdLogger struct {
// All log.Logger fields/methods are exposed.
@@ -71,11 +72,11 @@ type StdLogger struct {
}
/*
FileLogger uses a StdLogger with a file handle writer to write to the file given at Path.
FileLogger uses a StdLogger with a file handle writer to write to the file given at Path.
NOTE: If you wish to change the FileLogger.StdLogger.LogFlags, do *not* run FileLogger.StdLogger.Setup after doing so as this
will instead create a logger detached from the file handler. Instead, be sure to call FileLogger.Setup.
(Alternatively, run FileLogger.Shutdown and replace your logger with a new FileLogger.)
NOTE: If you wish to change the FileLogger.StdLogger.LogFlags, do *not* run FileLogger.StdLogger.Setup after doing so as this
will instead create a logger detached from the file handler. Instead, be sure to call FileLogger.Setup.
(Alternatively, run FileLogger.Shutdown and replace your logger with a new FileLogger.)
*/
type FileLogger struct {
// StdLogger is used for the log formation and handling. See StdLogger for more details.