Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Arg ¶
Arg represents an argument in the log format string. An Arg is represented in YAML as a map with a single element.
func (*Arg) MarshalYAML ¶
func (*Arg) UnmarshalYAML ¶
UnmarshalYAML custom unmarshals YAML node into Arg struct.
type Config ¶
type Config struct { // Additional imports for the generated code. // For the main code `slog.Logger` is already included. // For test code `github.com/stretchr/testify/require`, `testing`, `bytes`, `errors`, and `slog.Logger` are already included. Imports []string `json:"import" yaml:"imports"` Events map[string]struct { Type YAMLEnum[LogType] `json:"type" yaml:"type"` // Event type (errorf, verbosef). Level YAMLEnum[LogLevel] `json:"level" yaml:"level"` // Log level (error, warn, info, debug). Nice string `json:"nice" yaml:"nice"` // User-friendly message. Format string `json:"format" yaml:"format"` // Format string for identifying events. Args []*Arg `json:"args" yaml:"args"` // Arguments for the format string. Custom bool `json:"custom" yaml:"custom,omitempty"` // Flag for custom parsing. } `json:"events" yaml:"events"` }
Config struct defines the main configuration for generating the code.
type LogLevel ¶
type LogLevel string
LogLevel are the valid log levels available from [slog.Logger].
Click to show internal directories.
Click to hide internal directories.