logger

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	SetToDebug()
	SetToInfo()
	SetToError()
	Module(ns string) Logger
	Debug(msg string, keyValues ...interface{})
	Info(msg string, keyValues ...interface{})
	Error(msg string, keyValues ...interface{})
	Fatal(msg string, keyValues ...interface{})
	Warn(msg string, keyValues ...interface{})
}

Logger represents an interface for a logger

func NewLogrus

func NewLogrus(namespaceLevel map[string]logrus.Level) Logger

NewLogrus creates a logrus backed logger

func NewLogrusNoOp

func NewLogrusNoOp() Logger

NewLogrusNoOp creates a logrus backed logger that logs nothing

func NewLogrusWithFileRotation

func NewLogrusWithFileRotation(filePath string, namespaceLevel map[string]logrus.Level) Logger

NewLogrusWithFileRotation creates a logger with file backend and file rotation enabled. Two log file are created: - filePath.out stores DEBUG and INFO - filePath.err stores ERROR

type Logrus

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

Logrus implements Logger

func (*Logrus) Debug

func (l *Logrus) Debug(msg string, keyValues ...interface{})

Debug logs a message at level Debug on the standard logger

func (*Logrus) Error

func (l *Logrus) Error(msg string, keyValues ...interface{})

Error logs a message at level Error on the standard logger

func (*Logrus) Fatal

func (l *Logrus) Fatal(msg string, keyValues ...interface{})

Fatal logs a message at level Fatal on the standard logger

func (*Logrus) Info

func (l *Logrus) Info(msg string, keyValues ...interface{})

Info logs a message at level Info on the standard logger

func (*Logrus) Module

func (l *Logrus) Module(ns string) Logger

Module creates a new logger derived from l.

If the current logger has file rotation configured, the new logger will also be support file rotation.

If the current logger is set to debug, then the new logger is also set to debug.

func (*Logrus) SetToDebug

func (l *Logrus) SetToDebug()

SetToDebug sets the logger to DEBUG level

func (*Logrus) SetToError

func (l *Logrus) SetToError()

SetToError sets the logger to ERROR level

func (*Logrus) SetToInfo

func (l *Logrus) SetToInfo()

SetToInfo sets the logger to INFO level

func (*Logrus) Warn

func (l *Logrus) Warn(msg string, keyValues ...interface{})

Warn logs a message at level Warn on the standard logger

Jump to

Keyboard shortcuts

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