logger

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logger provides thread-safe logging capabilities with different severity levels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int

LogLevel represents the severity level of a log message

const (
	DEBUG LogLevel = iota
	INFO
	WARNING
	ERROR
)

Log levels ordered by increasing severity

func (LogLevel) String

func (l LogLevel) String() string

String returns the string representation of a LogLevel

type Logger

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

Logger provides thread-safe logging capabilities with different severity levels

func GetLogger

func GetLogger() *Logger

GetLogger returns a singleton instance of the Logger It initializes the logger on first call using sync.Once

func (*Logger) Debug

func (l *Logger) Debug(format string, v ...interface{}) error

Debug logs a debug-level message

func (*Logger) Error

func (l *Logger) Error(format string, v ...interface{}) error

Error logs an error-level message

func (*Logger) Info

func (l *Logger) Info(format string, v ...interface{}) error

Info logs an info-level message

func (*Logger) SetLevel

func (l *Logger) SetLevel(level LogLevel)

SetLevel changes the minimum severity level for logging Thread-safe through mutex locking

func (*Logger) Warning

func (l *Logger) Warning(format string, v ...interface{}) error

Warning logs a warning-level message

Jump to

Keyboard shortcuts

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