logger

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf added in v0.0.16

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

Debugf logs message with DEBUG log level.

func Errorf added in v0.0.16

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

Errorf logs message with ERROR log level.

func Fatalf added in v0.0.16

func Fatalf(format string, args ...interface{})

Fatalf logs message with FATAL log level.

func Infof added in v0.0.16

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

Infof logs message with INFO log level.

func NewLogger

func NewLogger(level LogLevel, dev bool)

NewLogger returns implementation of Logger interface.

Types

type Fields

type Fields map[string]interface{}

Fields to be passed when we want to call WithFields for structured logging.

type LogLevel added in v0.0.16

type LogLevel string

LogLevel represent level of logging.

const (
	// Debug has verbose message.
	Debug LogLevel = "debug"
	// Info is default log level.
	Info LogLevel = "info"
	// Error is for logging errors.
	Error LogLevel = "errors"
	// Fatal is for logging fatal messages. The system shutdown after logging the message.
	Fatal LogLevel = "fatal"
)

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})

	Infof(format string, args ...interface{})

	Errorf(format string, args ...interface{})

	Fatalf(format string, args ...interface{})

	WithFields(keyValues Fields) Logger
}

Logger is our contract for the logger.

func Log

func Log() Logger

func WithFields

func WithFields(keyValues Fields) Logger

WithFields builds nested logger with specified fields.

Jump to

Keyboard shortcuts

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