Documentation
¶
Overview ¶
Package slogsyslog implements log/slog.Handler for syslog server.
Index ¶
- type Facility
- type Options
- type SyslogHandler
- func (s *SyslogHandler) Close() error
- func (s *SyslogHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (s *SyslogHandler) Handle(ctx context.Context, r slog.Record) error
- func (s *SyslogHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (s *SyslogHandler) WithGroup(name string) slog.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Facility ¶
type Facility int
Facility is the log facility.
type Options ¶
type Options struct {
// AddSource, causes the handler to compute the source code position of the
// log statement and add it as a prefix to the message.
AddSource bool
// Level is the level at which we log at.
Level slog.Leveler
// Network protocol to use when connecting to a syslog server.
Network string
// Address of the syslog server.
Address string
// DialTimeout is duration after which connecting to a syslog server
// timeouts.
DialTimeout time.Duration
// WriteTimeout is duration after which writing to a syslog server timeouts.
WriteTimeout time.Duration
// Facility with which we are logging.
Facility Facility
// Tag with which we are logging.
Tag string
}
Options sets the syslog logging options.
type SyslogHandler ¶
type SyslogHandler struct {
// contains filtered or unexported fields
}
SyslogHandler is a structured log log/slog.Handler implementation that writes messages to a syslog server.
func New ¶
func New(opts *Options) (*SyslogHandler, error)
New creates a new syslog slog log/slog.Handler. By default it will log at log/slog.LevelInfo level to a UNIX datagram socket located at /dev/log.
func (*SyslogHandler) Close ¶
func (s *SyslogHandler) Close() error
Click to show internal directories.
Click to hide internal directories.