logger

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: MIT Imports: 8 Imported by: 6

README

logger

Go logger package wrapper using currently zerolog behind

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureFileLogger

func ConfigureFileLogger(config *Config) *lumberjack.Logger

func Debug

func Debug(msg string)

func Debugf

func Debugf(tmpl string, args ...interface{})

func Error

func Error(msg string)

func Errorf

func Errorf(tmpl string, args ...interface{})

func Info

func Info(msg string)

func Infof

func Infof(tmpl string, args ...interface{})

func Print

func Print(msg string)

func Printf

func Printf(tmpl string, args ...interface{})

func Sync

func Sync()

func Verbose

func Verbose() bool

func Warn

func Warn(msg string)

func Warnf

func Warnf(tmpl string, args ...interface{})

Types

type Config

type Config struct {
	Level      string `json:"level" yaml:"level"`
	Console    bool   `json:"console" yaml:"console"`
	FileConfig `json:"fileConfig" yaml:"fileConfig"`
}

func DefaultConfig

func DefaultConfig() *Config

type FileConfig

type FileConfig struct {
	Filename   string `json:"fileName" yaml:"fileName"`
	MaxSize    int    `json:"maxSize" yaml:"maxSize"`
	MaxAge     int    `json:"maxAge" yaml:"maxAge"`
	MaxBackups int    `json:"maxBackups" yaml:"maxBackups"`
	LocalTime  bool   `json:"localTime" yaml:"localTime"`
	Compress   bool   `json:"compress" yaml:"compress"`
}

type Logger

type Logger interface {
	Sync()
	Verbose() bool

	Debug(msg string)
	Debugf(tmpl string, args ...interface{})

	Info(msg string)
	Infof(tmpl string, args ...interface{})

	Warn(msg string)
	Warnf(tmpl string, args ...interface{})

	Error(msg string)
	Errorf(tmpl string, args ...interface{})

	Print(msg string)
	Printf(tmpl string, v ...interface{})

	L() Logger
}

func NewZap

func NewZap() Logger

func NewZapFromConfig

func NewZapFromConfig(logConfig *Config) Logger

func NewZero

func NewZero() Logger

func NewZeroFromConfig

func NewZeroFromConfig(config *Config) Logger

Jump to

Keyboard shortcuts

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