logger

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogDebug

func LogDebug(message string, args ...interface{})

func LogError

func LogError(message string, args ...interface{})

func LogFatal

func LogFatal(message string, args ...interface{})

func LogInfo

func LogInfo(message string, args ...interface{})

func LogWarn

func LogWarn(message string, args ...interface{})

func SetGlobal

func SetGlobal(logger *Logger)

Types

type Config

type Config struct {
	Level      Level
	Writer     io.Writer
	TimeFormat string
	Colorized  bool
}

Config

func DefaultConfig

func DefaultConfig() Config

type Fields

type Fields map[string]interface{}

type Level

type Level int
const (
	LevelDebug Level = iota

	LevelInfo

	LevelWarn

	LevelError

	LevelFatal
)

func ParseLevel

func ParseLevel(level string) Level

func (Level) String

func (l Level) String() string

representation of the log level

type Logger

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

func DefaultLogger

func DefaultLogger() *Logger

default configuration

func Global

func Global() *Logger

func New

func New(config Config) *Logger

logger instance

func (*Logger) Debug

func (l *Logger) Debug(message string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(message string, args ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(message string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(message string, args ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(message string, args ...interface{})

func (*Logger) WithField

func (l *Logger) WithField(key string, value interface{}) *Logger

func (*Logger) WithFields

func (l *Logger) WithFields(fields Fields) *Logger

func (*Logger) WithLevel

func (l *Logger) WithLevel(level Level) *Logger

Jump to

Keyboard shortcuts

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