logger

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LogFormatText represents human readable log format
	LogFormatText = "text"

	// DebugLevel represents debug level for logger
	DebugLevel = "debug"
	// TraceLevel represents trace level for logger
	TraceLevel = "trace"
	// InfoLevel represents info level for logger
	InfoLevel = "info"
)
View Source
const FileKey = "file"

FileKey holds the file field

View Source
const FunctionKey = "function"

FunctionKey holds the function field

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(logPath string, logLevel string) (*logrus.Logger, error)

InitLogger attempts to init logrus logger with output path passed in the parameter If path is incorrect or "" then init logger with stdout Receives logPath which is the file to write logs and logrus.Level which is level of logging (For example DEBUG, INFO) Returns created logrus.Logger or error if something went wrong

Types

type RuntimeFormatter

type RuntimeFormatter struct {
	ChildFormatter logrus.Formatter
	MaxLevel       logrus.Level
}

RuntimeFormatter decorates log entries with function name and package name (optional) and line number (optional)

func (*RuntimeFormatter) Format

func (f *RuntimeFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format the current log entry by adding the function name and line number of the caller.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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