log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomLoggerLevel = &slog.LevelVar{}

CustomLoggerLevel stores the current log level. Set it with Level()

View Source
var Logger = slog.Default()

Logger is the global log instance. Overwrite it with any slog.New() compatible logger to use your custom logger.

View Source
var LoggerFileMode os.FileMode = 0600

LoggerFileMode controls the file permission set by the custom file loggers of this package.

Functions

func Debug

func Debug(msg string, args ...any)

Debug will call slog.Logger.Debug on the global logger.

func Error

func Error(msg string, args ...any)

Error will call slog.Logger.Error on the global logger.

func Info

func Info(msg string, args ...any)

Info will call slog.Logger.Info on the global logger.

func Level

func Level(level slog.Level) (oldLevel slog.Level)

Level sets the global log level and returns the previous value.

func SetDefault

func SetDefault()

SetDefault will set the global Logger variable to slog.Default()

func SetFileJSON

func SetFileJSON(filePath string) error

SetFileJSON will set a custom file logger with JSON format.

func SetFileText

func SetFileText(filePath string) error

SetFileText will set a custom file logger with text format.

func SetMultiJSON

func SetMultiJSON(filePath string) error

SetMultiJSON will set a custom logger with JSON format, that will write into a file and os.Stderr.

func SetMultiText

func SetMultiText(filePath string) error

SetMultiText will set a custom logger with text format, that will write into a file and os.Stderr.

func SetStderrJSON

func SetStderrJSON()

SetStderrJSON will set a custom os.Stderr logger with JSON format.

func SetStderrText

func SetStderrText()

SetStderrText will set a custom os.Stderr logger with text format.

func Warn

func Warn(msg string, args ...any)

Warn will call slog.Logger.Warn on the global logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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