agdcslog

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package agdcslog contains slog handler implementation that writes to system log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyslogHandler added in v0.0.2

type SyslogHandler struct {
	// contains filtered or unexported fields
}

SyslogHandler is a slog.Handler that writes to system log.

func NewSyslogHandler added in v0.0.2

func NewSyslogHandler(logger SystemLogger, opts *slog.HandlerOptions) (h *SyslogHandler)

NewSyslogHandler returns an initialized SyslogHandler that writes to system log. opts must not be nil and contain Level.

func (*SyslogHandler) Close added in v0.0.2

func (h *SyslogHandler) Close() (err error)

Close closes an underlying system logger.

func (*SyslogHandler) Enabled added in v0.0.2

func (h *SyslogHandler) Enabled(_ context.Context, level slog.Level) (enabled bool)

Enabled implements the slog.Handler interface for *SyslogHandler.

func (*SyslogHandler) Handle added in v0.0.2

func (h *SyslogHandler) Handle(ctx context.Context, rec slog.Record) (err error)

Handle implements the slog.Handler interface for *SyslogHandler.

func (*SyslogHandler) WithAttrs added in v0.0.2

func (h *SyslogHandler) WithAttrs(attrs []slog.Attr) (handler slog.Handler)

WithAttrs implements the slog.Handler interface for *SyslogHandler.

func (*SyslogHandler) WithGroup added in v0.0.2

func (h *SyslogHandler) WithGroup(name string) (handler slog.Handler)

WithGroup implements the slog.Handler interface for *SyslogHandler.

type SystemLogger added in v0.0.2

type SystemLogger interface {
	// Debug logs a message at debug level.
	Debug(msg string) (err error)

	// Info logs a message at info level.
	Info(msg string) (err error)

	// Warning logs a message at warning level.
	Warning(msg string) (err error)

	// Error logs a message at error level.
	Error(msg string) (err error)

	// Close detaches from the system logger.
	io.Closer
}

SystemLogger is a platform-specific system logger.

TODO(e.burkov): Consider moving to golibs.

func NewSystemLogger

func NewSystemLogger(name string) (l SystemLogger, err error)

NewSystemLogger returns a platform-specific system logger. name is the name of service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL