fixing multilogger so that v is properly nil instead of an empty slice if not specified

This commit is contained in:
2022-01-05 16:16:24 -05:00
parent 0e01306637
commit 4addc44c0f
5 changed files with 85 additions and 18 deletions

View File

@@ -2,7 +2,7 @@ package logging
import (
"log"
"os"
`os`
)
/*
@@ -24,7 +24,10 @@ type Logger interface {
Shutdown()
}
// StdLogger uses the log package in stdlib to perform all logging.
/*
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.
*log.Logger
@@ -39,10 +42,16 @@ type StdLogger struct {
// FileLogger uses a StdLogger with a file handle writer to write to the file given at Path.
type FileLogger struct {
// StdLogger is used for the log formation and handling.
// StdLogger is used for the log formation and handling. See StdLogger for more details.
StdLogger
// Path is the path to the logfile.
Path string
/*
EnableStdOut is true if the log will send to STDOUT as well as the file.
If false (default), it will only (silently) write to the log file.
You will need to run *FileLogger.Shutdown and then *FileLogger.Setup again if you wish to change this.
*/
EnableStdOut bool
// writer is used for the writing out of the log file.
writer *os.File
}