log

package module
v0.0.0-...-fbaf9a3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 7 Imported by: 7

README

log

Logging wrapper library based on zerolog.

Installing

go get github.com/alexferl/golib/log

Documentation

Index

Constants

View Source
const (
	LogOutput = "log-output"
	LogWriter = "log-writer"
	LogLevel  = "log-level"
)
View Source
const (
	PanicLevel = "PANIC"
	FatalLevel = "FATAL"
	ErrorLevel = "ERROR"
	WarnLevel  = "WARN"
	InfoLevel  = "INFO"
	DebugLevel = "DEBUG"
	TraceLevel = "TRACE"
	Disabled   = "DISABLED"
)
View Source
const (
	WriterConsole = "console"
	WriterJSON    = "json"
)
View Source
const (
	OutputStdOut = "stdout"
	OutputStdErr = "stderr"
)

Variables

View Source
var DefaultConfig = &Config{
	LogLevel:  InfoLevel,
	LogOutput: OutputStdOut,
	LogWriter: WriterConsole,
}

Functions

func New

func New(config *Config) error

New initializes the logger based on the passed Config, defaults to DefaultConfig if `config` is nil.

Types

type Config

type Config struct {
	LogLevel  string
	LogOutput string
	LogWriter string
}

Config holds all log configuration.

func (*Config) BindFlags

func (c *Config) BindFlags(fs *pflag.FlagSet)

BindFlags adds all the flags from the command line.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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