slogger

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Zlib Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFilesWriter added in v0.1.0

func NewFilesWriter(filename string) io.Writer

NewFilesWriter creates a new rolling files writer. It rotates the log file when it reaches a certain size, age...

func SetLogger

func SetLogger(ctx context.Context, c config.LoggerConfig)

SetLogger sets the logger with the given config settings. The default logger is tint logger with colorized output.

Types

type BarkWriter added in v0.0.7

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

BarkWriter is a writer that sends log messages to Bark.

func NewBark added in v0.0.7

func NewBark(token string) *BarkWriter

NewBark creates a new BarkWriter instance with the given token.

func (*BarkWriter) Write added in v0.0.7

func (bw *BarkWriter) Write(msg []byte) (n int, err error)

Write sends the log message to Bark, it implements the io.Writer interface. It is called by the log/slog package when a log message is written.

type CtxKey added in v0.0.7

type CtxKey int

CtxKey is the key type for context.

const (
	CtxVersionKey CtxKey = iota // version key
)

type NewRelicWriter added in v0.0.7

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

NewRelicWriter is a writer that sends log messages to NewRelic.

func NewRelic added in v0.0.7

func NewRelic(key string) *NewRelicWriter

NewRelic creates a new NewRelicWriter with the given API key.

func (*NewRelicWriter) Write added in v0.0.7

func (nr *NewRelicWriter) Write(msg []byte) (n int, err error)

Write sends the log message to NewRelic, it implements the io.Writer interface. It is called by the log/slog package when a log message is written.

type TelegramWriter added in v0.0.7

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

TelegramWriter is a writer that sends log messages to Telegram by using Bot API.

func NewTelegram added in v0.0.7

func NewTelegram(token string) *TelegramWriter

NewTelegram creates new TelegramWriter instance with the given token.

func (*TelegramWriter) SetChatID added in v0.0.7

func (th *TelegramWriter) SetChatID(chatID any)

SetChatID sets `chat_id` field in JSON payload sent to Telegram API.

func (*TelegramWriter) Write added in v0.0.7

func (th *TelegramWriter) Write(msg []byte) (n int, err error)

Write sends the log message to Telegram Bot API, it implements the io.Writer interface. It is called by the log/slog package when a log message is written.

Jump to

Keyboard shortcuts

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