logg

package
v0.0.0-...-a015d60 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package logg provides helper functions logging.

Index

Constants

View Source
const (
	DEBUG = iota // 0
	INFO
	WARN
	ERROR
)

Define log levels.

Variables

This section is empty.

Functions

func FormatValue

func FormatValue(value interface{}) interface{}

Converte valori come time.Duration in formati leggibili

func GetCaller

func GetCaller() (string, int)

GetCaller return filename + code line number of the caller.

func GetLogFileName

func GetLogFileName(logDir, prefix string) string

Types

type LogField

type LogField struct {
	Key   string
	Value interface{}
}

LogField represents a key-value pair in a log row.

func Field

func Field(key string, value interface{}) LogField

type Logger

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

Logger represents a log object.

func NewLogger

func NewLogger(level int, logDir string) (*Logger, error)

func (*Logger) Close

func (l *Logger) Close()

func (*Logger) Debug

func (l *Logger) Debug(msg string, fields ...LogField)

func (*Logger) Error

func (l *Logger) Error(msg string, fields ...LogField)

func (*Logger) Info

func (l *Logger) Info(msg string, fields ...LogField)

func (*Logger) Warn

func (l *Logger) Warn(msg string, fields ...LogField)

Jump to

Keyboard shortcuts

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