logging

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogLevels = struct {
	INFO, DEBUG, WARN, ERROR slog.Level
}{
	INFO:  slog.LevelInfo,
	DEBUG: slog.LevelDebug,
	WARN:  slog.LevelWarn,
	ERROR: slog.LevelError,
}

LogLevels are a simple abstractions on slog.Level.

Functions

func GetInstance

func GetInstance(logLevel slog.Level, logFilePath string) *slog.Logger

GetInstance implemented as singleton pattern to get Logger instance, created once for whole app:.

func GetLogTraceback

func GetLogTraceback() string

GetLogTraceback return a string with info about filename, function name and line https://stackoverflow.com/questions/25927660/how-to-get-the-current-function-name

Types

type Config

type Config struct {
	Level       slog.Level
	LogFilePath string
}

Config is a logging config, on base of which logger instance is created.

Jump to

Keyboard shortcuts

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