Documentation ¶
Index ¶
- Constants
- func FromContext(ctx context.Context) *slog.Logger
- func GetLogger(ctx context.Context, subsys Subsystem) *slog.Logger
- func NewLogFile(filename string) (f *logFile, err error)
- func OutletsFromConfig(in config.LoggingOutletEnumList) (*logger.Outlets, error)
- func ParseOutlet(in config.LoggingOutletEnum) (o slog.Handler, err error)
- func With(ctx context.Context, args ...any) context.Context
- func WithLogger(ctx context.Context, l *slog.Logger) context.Context
- type Buffer
- type FileOutlet
- func (self *FileOutlet) Enabled(ctx context.Context, level slog.Level) bool
- func (self *FileOutlet) Handle(_ context.Context, r slog.Record) error
- func (self *FileOutlet) WithAttrs(attrs []slog.Attr) slog.Handler
- func (self *FileOutlet) WithFormatter(f Formatter) *FileOutlet
- func (self *FileOutlet) WithGroup(name string) slog.Handler
- func (self *FileOutlet) WithWriter(w io.Writer) *FileOutlet
- type Formatter
- type SlogFormatter
- func (self *SlogFormatter) Enabled(ctx context.Context, level slog.Level) bool
- func (self *SlogFormatter) Format(r slog.Record) ([]byte, error)
- func (self *SlogFormatter) WithAttrs(attrs []slog.Attr) Formatter
- func (self *SlogFormatter) WithGroup(name string) Formatter
- func (self *SlogFormatter) WithHideFields(fields []string) *SlogFormatter
- func (self *SlogFormatter) WithJsonHandler() *SlogFormatter
- func (self *SlogFormatter) WithLevel(level slog.Level) *SlogFormatter
- func (self *SlogFormatter) WithLogLevel(enable bool) *SlogFormatter
- func (self *SlogFormatter) WithLogMetadata(v bool) *SlogFormatter
- func (self *SlogFormatter) WithLogTime(enable bool) *SlogFormatter
- func (self *SlogFormatter) WithTextHandler() *SlogFormatter
- func (self *SlogFormatter) Write(w io.Writer, r slog.Record) error
- type Subsystem
- type SyslogOutlet
- type TCPOutlet
Constants ¶
View Source
const ( JobField string = "job" SubsysField string = "subsystem" )
Variables ¶
This section is empty.
Functions ¶
func NewLogFile ¶ added in v0.9.2
func OutletsFromConfig ¶
func OutletsFromConfig(in config.LoggingOutletEnumList, ) (*logger.Outlets, error)
func ParseOutlet ¶
func ParseOutlet(in config.LoggingOutletEnum) (o slog.Handler, err error)
Types ¶
type FileOutlet ¶
type FileOutlet struct {
// contains filtered or unexported fields
}
func NewFileOutlet ¶ added in v0.9.2
func NewFileOutlet(filename string, formatter *SlogFormatter, ) (*FileOutlet, error)
func (*FileOutlet) WithAttrs ¶ added in v0.9.2
func (self *FileOutlet) WithAttrs(attrs []slog.Attr) slog.Handler
func (*FileOutlet) WithFormatter ¶
func (self *FileOutlet) WithFormatter(f Formatter) *FileOutlet
func (*FileOutlet) WithGroup ¶ added in v0.9.2
func (self *FileOutlet) WithGroup(name string) slog.Handler
func (*FileOutlet) WithWriter ¶
func (self *FileOutlet) WithWriter(w io.Writer) *FileOutlet
type SlogFormatter ¶
type SlogFormatter struct {
// contains filtered or unexported fields
}
func NewSlogFormatter ¶
func NewSlogFormatter() *SlogFormatter
func (*SlogFormatter) WithAttrs ¶ added in v0.9.2
func (self *SlogFormatter) WithAttrs(attrs []slog.Attr) Formatter
func (*SlogFormatter) WithGroup ¶ added in v0.9.2
func (self *SlogFormatter) WithGroup(name string) Formatter
func (*SlogFormatter) WithHideFields ¶
func (self *SlogFormatter) WithHideFields(fields []string) *SlogFormatter
func (*SlogFormatter) WithJsonHandler ¶
func (self *SlogFormatter) WithJsonHandler() *SlogFormatter
func (*SlogFormatter) WithLevel ¶
func (self *SlogFormatter) WithLevel(level slog.Level) *SlogFormatter
func (*SlogFormatter) WithLogLevel ¶ added in v0.9.2
func (self *SlogFormatter) WithLogLevel(enable bool) *SlogFormatter
func (*SlogFormatter) WithLogMetadata ¶ added in v0.9.2
func (self *SlogFormatter) WithLogMetadata(v bool) *SlogFormatter
func (*SlogFormatter) WithLogTime ¶
func (self *SlogFormatter) WithLogTime(enable bool) *SlogFormatter
func (*SlogFormatter) WithTextHandler ¶
func (self *SlogFormatter) WithTextHandler() *SlogFormatter
type SyslogOutlet ¶
type SyslogOutlet struct { Formatter Formatter RetryInterval time.Duration Facility syslog.Priority // contains filtered or unexported fields }
func NewSyslogOutlet ¶ added in v0.9.2
func NewSyslogOutlet(f *SlogFormatter, facility syslog.Priority, retryInterval time.Duration, ) *SyslogOutlet
Click to show internal directories.
Click to hide internal directories.