Documentation ¶
Overview ¶
Package slog provides slog logging.
Index ¶
- Constants
- type Level
- type Log
- func (this *Log) Debug(message string, arguments ...any)
- func (this *Log) Error(message string, arguments ...any)
- func (this *Log) Fatal(message string, arguments ...any)
- func (this *Log) Flush()
- func (this *Log) GetLevel() Level
- func (this *Log) Info(message string, arguments ...any)
- func (this *Log) SetLevel(level Level)
- func (this *Log) SetOutputToFile(fileName, fileExtensionName string, addDate bool)
- func (this *Log) SetOutputToStderr()
- func (this *Log) SetOutputToStdout()
- func (this *Log) SetWithCallerInfo(withCallerInfo bool)
- func (this *Log) Trace(message string, arguments ...any)
- func (this *Log) Warn(message string, arguments ...any)
Constants ¶
const ( LevelTrace = Level(-8) LevelDebug = Level(slog.LevelDebug) LevelInfo = Level(slog.LevelInfo) LevelWarn = Level(slog.LevelWarn) LevelError = Level(slog.LevelError) LevelFatal = Level(12) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is struct that provides log related methods.
func (*Log) Debug ¶
Debug means recording debug level logs.
ex) testLog.Debug("message-02", "key-01", "value-02", "key-02", 2)
func (*Log) Error ¶
Error means recording error level logs.
ex) testLog.Error("message-05", "key-01", "value-05", "key-02", 5)
func (*Log) Fatal ¶
Fatal means recording fatal level logs.
ex) testLog.Fatal("message-06", "key-01", "value-06", "key-02", 6)
func (*Log) Flush ¶
func (this *Log) Flush()
Flush waits to record the logs accumulated up to the time it was called.
ex) testLog.Flush()
func (*Log) Info ¶
Info means recording info level logs.
ex) testLog.Info("message-03", "key-01", "value-03", "key-02", 3)
func (*Log) SetOutputToFile ¶
SetOutputToFile sets the output to file.
ex) testLog.SetOutputToFile(fileName, fileExtensionName, true)
func (*Log) SetOutputToStderr ¶
func (this *Log) SetOutputToStderr()
SetOutputToStderr sets the output to standard error.
ex) testLog.SetOutputToStderr()
func (*Log) SetOutputToStdout ¶
func (this *Log) SetOutputToStdout()
SetOutputToStdout sets the output to standard output.
ex) testLog.SetOutputToStdout()
func (*Log) SetWithCallerInfo ¶
SetWithCallerInfo also records caller information.
ex) testLog.SetWithCallerInfo(true)