21 lines
507 B
Go
21 lines
507 B
Go
|
package application
|
||
|
|
||
|
import (
|
||
|
"log/slog"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
func (a *Application) initializeLogger() {
|
||
|
a.baseLogger = slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
|
||
|
AddSource: true,
|
||
|
Level: slog.LevelDebug,
|
||
|
}))
|
||
|
|
||
|
a.appLogger = a.baseLogger.With("module", "application")
|
||
|
}
|
||
|
|
||
|
// NewLogger creates new sub-instance of base logger and adds some additional data to it for persistent output.
|
||
|
func (a *Application) NewLogger(withs ...interface{}) *slog.Logger {
|
||
|
return a.baseLogger.With(withs...)
|
||
|
}
|