logger

package
v1.9.11 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const (
	NO_FILE = "true"
)

Variables

This section is empty.

Functions

func GetTimeFromLine added in v1.3.22

func GetTimeFromLine(input string) (t time.Time)

GetTimeFromLine ...

Types

type Logger added in v1.3.0

type Logger interface {
	Debug(msg string, ctx ...interface{})
	Info(msg string, ctx ...interface{})
	Warn(msg string, ctx ...interface{})
	Error(msg string, ctx ...interface{})
	Crit(msg string, ctx ...interface{})
}

Logger writes key/pair values to a handler

func Init

func Init(serviceName, contextName string, args ...string) Logger

Init instantiates the logger with the specified arguments.

The first `args` parameter is the logger filename (default: logger.log).

The second `args` parameter indicates whether to get rid of any file logging (default: "false"). You might want to use the `logger.NO_FILE` constant as this second parameter or the string "true", eg.

log := logger.Init("my_package", "MyFunction", "", logger.NO_FILE)

IMPORTANT: The logger will log to stderr and to the file unless stated otherwise.

func InitHandler

func InitHandler(serviceName, contextName, requestID string, args ...string) Logger

InitHandler is generally used in API handlers to display the request ID.

IMPORTANT: The logger will log to stderr and to the file.

func New added in v1.3.0

func New(filename string, ctx ...interface{}) Logger

New ...

type Lvl added in v1.3.0

type Lvl int

Lvl is a type for predefined log levels.

const (
	LvlCrit Lvl = iota
	LvlError
	LvlWarn
	LvlInfo
	LvlDebug
)

List of predefined log Levels

func (Lvl) String added in v1.3.0

func (l Lvl) String() string

Returns the name of a Lvl

Jump to

Keyboard shortcuts

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