log

package
v3.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Logger is the logger to use. If not set, a default logger will be used.
	Logger *slog.Logger

	// LogLevel defines the log level of the logger.
	LogLevel slog.Level

	// Handles errors that occur when writing to the log
	ErrorHandler func(err error)
}

type LoggerService

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

func New

func New() *LoggerService

func NewLoggerService

func NewLoggerService(config *Config) *LoggerService

func (*LoggerService) Debug

func (l *LoggerService) Debug(message string, args ...any)

func (*LoggerService) Error

func (l *LoggerService) Error(message string, args ...any)

func (*LoggerService) Info

func (l *LoggerService) Info(message string, args ...any)

func (*LoggerService) Name

func (l *LoggerService) Name() string

Name returns the name of the plugin. You should use the go module format e.g. github.com/myuser/myplugin

func (*LoggerService) OnShutdown

func (l *LoggerService) OnShutdown() error

OnShutdown is called when the app is shutting down You can use this to clean up any resources you have allocated

func (*LoggerService) OnStartup

func (l *LoggerService) OnStartup(ctx context.Context, options application.ServiceOptions) error

func (*LoggerService) SetLogLevel

func (l *LoggerService) SetLogLevel(level slog.Level)

func (*LoggerService) Warning

func (l *LoggerService) Warning(message string, args ...any)

Jump to

Keyboard shortcuts

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