logger

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package logger contains logger API definition, wrapper that can be used around any other logger.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLogLevel = errors.New("unrecognized log level")

ErrInvalidLogLevel indicates an unrecognized log level.

Functions

This section is empty.

Types

type Level

type Level int

Level represents severity level while logging.

const (
	// Error level is used when logging errors.
	Error Level = iota + 1
	// Warn level is used when logging warnings.
	Warn
	// Info level is used when logging info data.
	Info
	// Debug level is used when logging debugging info.
	Debug
)

func (Level) String

func (lvl Level) String() string

func (*Level) UnmarshalText

func (lvl *Level) UnmarshalText(text string) error

UnmarshalText returns log Level for the given string representation.

type Logger

type Logger interface {
	// Debug logs any object in JSON format on debug level.
	Debug(string)
	// Info logs any object in JSON format on info level.
	Info(string)
	// Warn logs any object in JSON format on warning level.
	Warn(string)
	// Error logs any object in JSON format on error level.
	Error(string)
}

Logger specifies logging API.

func New

func New(out io.Writer, levelText string) (Logger, error)

New returns wrapped go kit logger.

func NewMock

func NewMock() Logger

NewMock returns wrapped go kit logger mock.

Jump to

Keyboard shortcuts

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