libpack_logger

package
v0.34.7 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LEVEL_DEBUG = iota
	LEVEL_INFO
	LEVEL_WARN
	LEVEL_ERROR
	LEVEL_FATAL
)

Variables

This section is empty.

Functions

func GetLogLevel added in v0.18.7

func GetLogLevel(level string) int

GetLogLevel returns the log level integer corresponding to the given level name.

Types

type LogMessage added in v0.18.7

type LogMessage struct {
	Pairs   map[string]interface{}
	Message string
}

LogMessage represents a log message with optional pairs.

type Logger added in v0.18.7

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

Logger represents the logging object with configurations.

func New added in v0.18.7

func New() *Logger

New creates a new Logger with default settings.

func (*Logger) Critical added in v0.18.7

func (l *Logger) Critical(m *LogMessage)

Critical logs a critical-level message and exits the application.

func (*Logger) Debug added in v0.18.7

func (l *Logger) Debug(m *LogMessage)

Debug logs a debug-level message.

func (*Logger) Error added in v0.18.7

func (l *Logger) Error(m *LogMessage)

Error logs an error-level message.

func (*Logger) Fatal added in v0.18.7

func (l *Logger) Fatal(m *LogMessage)

Fatal logs a fatal-level message.

func (*Logger) Info added in v0.18.7

func (l *Logger) Info(m *LogMessage)

Info logs an info-level message.

func (*Logger) SetFieldName added in v0.18.7

func (l *Logger) SetFieldName(field, name string) *Logger

SetFieldName allows customizing the field names in log output.

func (*Logger) SetMinLogLevel added in v0.18.7

func (l *Logger) SetMinLogLevel(level int) *Logger

SetMinLogLevel sets the minimum log level for the logger.

func (*Logger) SetOutput added in v0.18.7

func (l *Logger) SetOutput(output io.Writer) *Logger

SetOutput sets the output destination for the logger.

func (*Logger) SetShowCaller added in v0.18.7

func (l *Logger) SetShowCaller(show bool) *Logger

SetShowCaller enables or disables including the caller information in log output.

func (*Logger) SetTimeFormat added in v0.23.85

func (l *Logger) SetTimeFormat(format string) *Logger

SetTimeFormat sets the time format for the logger's timestamp field.

func (*Logger) Warn added in v0.18.7

func (l *Logger) Warn(m *LogMessage)

Warn logs a warning-level message.

func (*Logger) Warning added in v0.18.7

func (l *Logger) Warning(m *LogMessage)

Warning is an alias for Warn.

Jump to

Keyboard shortcuts

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