Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct { Time time.Time `json:"time"` Level slog.Level `json:"level"` Message string `json:"msg"` Error string `json:"error"` Raw json.RawMessage }
Entry is a convenience struct containing basic information TODO replace the fields with methods to save ram
func (Entry) Get ¶
Use Get if you want to get a value from a LogEntry that is not contained within the message. Use the dot notation for that. For more information about dot notation see https://github.com/tidwall/gjson
func (Entry) GetMany ¶
GetMany searches json for the multiple paths. The return value is a Result array where the number of items will be equal to the number of input paths. Use the dot notation for that. For more information about dot notation see https://github.com/tidwall/gjson
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Inspired by Logrus Testing Hook, this is my version for slog.
func NewHookLoggerWithOptions ¶
func NewHookLoggerWithOptions(options *slog.HandlerOptions) (Hook, *slog.Logger)
type LogConfig ¶
type LogConfig struct { Verbose bool `short:"v" long:"verbose" env:"VERBOSE" description:"Short hand for log level debug. Will override any setting for level"` Level LogLevel `` /* 131-byte string literal not displayed */ Format LogFormat `short:"f" long:"format" env:"FORMAT" default:"text" choice:"text" choice:"json" choice:"pretty" description:"Log format"` }
You can use LogConfig like this:
Log goslog.LogConfig `group:"Log Options" namespace:"log" env-namespace:"LOG"`
type LogFormat ¶
type LogFormat int
func (*LogFormat) MarshalFlag ¶
MarshalFlag converts a CookieDomain to a string
func (*LogFormat) UnmarshalFlag ¶
UnmarshalFlag converts a string to a CookieDomain
type LogLevel ¶
func (*LogLevel) MarshalFlag ¶
MarshalFlag converts a CookieDomain to a string
func (*LogLevel) UnmarshalFlag ¶
UnmarshalFlag converts a string to a CookieDomain