logger

package
v0.0.0-...-884d78e Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// LevelUndefined is the erroneous value of log-level which corresponds
	// to zero-value.
	LevelUndefined = internal.LevelUndefined

	// LevelFatal will report about Fatalf-s only.
	LevelFatal = internal.LevelFatal

	// LevelPanic will report about Panicf-s and Fatalf-s only.
	LevelPanic = internal.LevelPanic

	// LevelError will report about Errorf-s, Panicf-s, ...
	LevelError = internal.LevelError

	// LevelWarning will report about Warningf-s, Errorf-s, ...
	LevelWarning = internal.LevelWarning

	// LevelInfo will report about Infof-s, Warningf-s, ...
	LevelInfo = internal.LevelInfo

	// LevelDebug will report about Debugf-s, Infof-s, ...
	LevelDebug = internal.LevelDebug

	// EndOfLevel is just used as a limiter for `for`-s.
	EndOfLevel
)

Variables

This section is empty.

Functions

func RegisterAdapter

func RegisterAdapter(adapter Adapter)

RegisterAdapter registers an Adapter to be used by ConvertLogger.

Types

type Adapter

type Adapter interface {
	Convert(backend interface{}) Logger
}

Adapter defines an adapter to convert a logger to Logger.

type Level

type Level = internal.Level

Level is used to define severity of messages to be reported.

func ParseLogLevel

func ParseLogLevel(in string) (Level, error)

ParseLogLevel parses incoming string into a Level and returns LevelUndefined with an error if an unknown logging level was passed.

type Logger

type Logger = internal.Logger

Logger is the interface of a logger provided by an extended context.

This is the complete logger with all the required methods/features.

func ConvertLogger

func ConvertLogger(logger interface{}) Logger

ConvertLogger converts arbitrary logger to Logger. If it was unable to then it returns a nil.

To enable logadapter-s for this converter add imports, for example:

import _ "github.com/facebookincubator/contest/pkg/xcontext/logger/logadapter/logrus"
import _ "github.com/facebookincubator/contest/pkg/xcontext/logger/logadapter/zap"

func Dummy

func Dummy() Logger

Dummy returns a dummy logger which implements Logger, but does nothing.

type MinimalLogger

type MinimalLogger = internal.MinimalLogger

MinimalLogger is the interfaces of a logger without contextual methods.

Directories

Path Synopsis
Package internal of logger unifies different types of loggers into interfaces Logger.
Package internal of logger unifies different types of loggers into interfaces Logger.
logadapter
zap

Jump to

Keyboard shortcuts

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