Initialize narratio Go module and CLI scaffold
This commit is contained in:
17
internal/logging/logging.go
Normal file
17
internal/logging/logging.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log/slog"
|
||||
"os"
|
||||
)
|
||||
|
||||
// NewLogger creates a text slog logger.
|
||||
func NewLogger(out io.Writer, level slog.Level) *slog.Logger {
|
||||
if out == nil {
|
||||
out = os.Stderr
|
||||
}
|
||||
|
||||
handler := slog.NewTextHandler(out, &slog.HandlerOptions{Level: level})
|
||||
return slog.New(handler)
|
||||
}
|
||||
Reference in New Issue
Block a user