Documentation
¶
Index ¶
- Constants
- func From(ctx context.Context) *slog.Logger
- func MustParseLogLevel(levelStr string) slog.Level
- func NewLogger(config ...Config) *slog.Logger
- func ParseLogLevel(levelStr string) (slog.Level, error)
- func With(ctx context.Context, logger *slog.Logger) context.Context
- type Config
- type LogFormat
Constants ¶
View Source
const (
TimeFormat string = "2006-01-02T15:04:05.000000"
)
Variables ¶
This section is empty.
Functions ¶
func From ¶ added in v0.5.0
From returns the logger from the context. Returns a new logger if no logger is found in the context.
func MustParseLogLevel ¶ added in v0.5.1
MustParseLogLevel parses a string into a slog.Level and panics if it fails
func NewLogger ¶ added in v0.5.0
NewLogger returns a new slog.Logger with the provided settings.
func ParseLogLevel ¶ added in v0.5.0
ParseLogLevel parses a string into a slog.Level
Types ¶
type Config ¶ added in v0.1.1
type Config struct {
// Level is the log Level for the logger that will be used
Level slog.Level `default:"info"`
// Format is the log Format for the logger that will be used
Format LogFormat `default:"text"`
// Output is the output writer that the logger will use
Output io.Writer
}
Config holds the settings for the logger
type LogFormat ¶
type LogFormat string
func MustParseLogFormat ¶ added in v0.5.1
MustParseLogFormat parses a string into a LogFormat and panics if it fails
func ParseLogFormat ¶ added in v0.5.1
ParseLogFormat parses a string into a LogFormat
Click to show internal directories.
Click to hide internal directories.