logger

package module
v0.0.0-...-c330448 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Logger

Index

Constants

View Source
const (
	// Zap implementation
	Zap int = iota
	// Logrus implementation
	Logrus
)
View Source
const (
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FATAL_LEVEL int = iota
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ERROR_LEVEL
	// WarnLevel level. Non-critical entries that deserve eyes.
	WARN_LEVEL
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	INFO_LEVEL
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DEBUG_LEVEL
)

The severity levels. Higher values are more considered more important.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Level      int
	Writer     io.Writer
	TimeFormat string
}

Configuration - options for logger

type Logger

type Logger interface {
	Fatal(msg string, fields ...field.Fields)
	FatalWithContext(ctx context.Context, msg string, fields ...field.Fields)

	Error(msg string, fields ...field.Fields)
	ErrorWithContext(ctx context.Context, msg string, fields ...field.Fields)

	Warn(msg string, fields ...field.Fields)
	WarnWithContext(ctx context.Context, msg string, fields ...field.Fields)

	Info(msg string, fields ...field.Fields)
	InfoWithContext(ctx context.Context, msg string, fields ...field.Fields)

	Debug(msg string, fields ...field.Fields)
	DebugWithContext(ctx context.Context, msg string, fields ...field.Fields)

	Get() interface{}

	// Closer is the interface that wraps the basic Close method.
	io.Closer
	// contains filtered or unexported methods
}

Logger is our contract for the logger

func NewLogger

func NewLogger(loggerInstance int, config Configuration) (Logger, error)

NewLogger - return new an instance of logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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