Categorygithub.com/obalunenko/logger
modulepackage
1.2.0
Repository: https://github.com/obalunenko/logger.git
Documentation: pkg.go.dev

# README

GO License GoDoc Go Report Card

logger

A configurable structure leveled logger stored in context with an adapter interface for logger libraries allows not to depend on any of them directly.

# Functions

ContextWithLogger adds Logger to context and returns new context.
Debug prints debug-level log message.
Error prints error-level log message.
Fatal prints fatal-level log message and exit the program with code 1.
FromContext extracts Logger from context.
Info prints info-level log message.
Init initiates logger and add format options.
ParseLevel takes a string level and returns the Logrus log level constant.
Warn prints warn-level log message.
WithError adds an error as single field to the Logger Entry.
WithField adds s single field to the Logger Entry.
WithFields adds fields key-value to the Logger Entry.

# Constants

LevelDebug is a debug level.
LevelError is an error level.
LevelFatal is a fatal level.
LevelInfo is an info level.
LevelWarn is a warn level.

# Variables

AllLevels is a slice of all levels.

# Structs

Params holds logger specific params.

# Interfaces

Logger serves as an adapter interface for logger libraries so that we not depend on any of them directly.

# Type aliases

Fields type, used to pass to `WithFields`.
Level type.