logging

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 3 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

This section is empty.

Types

type Logger

type Logger interface {
	Panic(fmt string, a ...interface{})
	Fatal(fmt string, a ...interface{})
	Error(fmt string, a ...interface{})
	Warn(fmt string, a ...interface{})
	Info(fmt string, a ...interface{})
	Debug(fmt string, a ...interface{})
	Trace(fmt string, a ...interface{})

	WithFields(map[string]interface{}) Logger
	WithField(string, interface{}) Logger
	WithError(err error) Logger

	GetLevel() string
	SetLevel(string)

	SetOutputFormat(format string)
	SetCallerReporter()
}

type StandardLogger

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

func GetRoot

func GetRoot() *StandardLogger

GetRoot returns the root logger application.

func New

func New() *StandardLogger

New returns a new application logger.

func (*StandardLogger) Debug

func (l *StandardLogger) Debug(fmt string, a ...interface{})

func (*StandardLogger) Error

func (l *StandardLogger) Error(fmt string, a ...interface{})

func (*StandardLogger) Fatal

func (l *StandardLogger) Fatal(fmt string, a ...interface{})

func (*StandardLogger) GetLevel

func (l *StandardLogger) GetLevel() string

GetLevel return the current logging level.

func (*StandardLogger) Info

func (l *StandardLogger) Info(fmt string, a ...interface{})

func (*StandardLogger) Panic

func (l *StandardLogger) Panic(fmt string, a ...interface{})

func (*StandardLogger) SetCallerReporter

func (l *StandardLogger) SetCallerReporter()

SetCallerReporter add calling method as a field.

func (*StandardLogger) SetLevel

func (l *StandardLogger) SetLevel(level string)

SetLevel sets the logger level.

func (*StandardLogger) SetOutput

func (l *StandardLogger) SetOutput(w io.Writer)

SetOutput sets the underlying logrus output.

func (*StandardLogger) SetOutputFormat

func (l *StandardLogger) SetOutputFormat(format string)

SetOutputFormat change the logger format. available formats: text/json

func (*StandardLogger) Trace

func (l *StandardLogger) Trace(fmt string, a ...interface{})

func (*StandardLogger) Warn

func (l *StandardLogger) Warn(fmt string, a ...interface{})

func (*StandardLogger) WithError

func (l *StandardLogger) WithError(err error) Logger

WithError add an error as single field to the logger.

func (*StandardLogger) WithField

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

WithField create new logger instance with singe field.

func (*StandardLogger) WithFields

func (l *StandardLogger) WithFields(fields map[string]interface{}) Logger

WithFields create new logger instance with the given default fields.

Example: logger :=log.WithFields(map[string]interface{}{"test": 2222}) logger.Info("Teller message") -> `INFO[0000] Teller message test=2222`

Jump to

Keyboard shortcuts

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