log

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(s string)

Debug logs a debug messagewith the default logger

func Destroy

func Destroy()

Destroy closes the log file

func Error

func Error(s string)

Errors logs a message with level `error`with the default logger

func Fatal

func Fatal(s string)

Fatal logs the message and exits with non-zero exit code with the default logger

func Info

func Info(s string)

Info logs a message with level `info`with the default logger

func Init

func Init(c config.LogConfig)

Init initializes the default logger with a log path if specified

func SetLevel

func SetLevel(l string)

SetLevel sets the level of the default logger

func Warn

func Warn(s string)

Warn logs a message with level `warning`with the default logger

Types

type LogParams

type LogParams map[string]interface{}

LogParams wrapper around key values used for logging

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger for logging

var DefaultLogger *Logger

DefaultLogger stores the instance of the DefaultLogger

func NewLogger

func NewLogger(c config.LogConfig) *Logger

NewLogger instantiates logger based on the config

func With

func With(params LogParams) *Logger

With returns a logger with the specified parameters

func (*Logger) Debug

func (l *Logger) Debug(s string)

Debug logs a debug message

func (*Logger) Destroy

func (l *Logger) Destroy()

Destroy should be called when exiting to close the log file

func (*Logger) Error

func (l *Logger) Error(s string)

Error logs a message with level `error`

func (*Logger) Fatal

func (l *Logger) Fatal(s string)

Fatal logs the message and exits with non-zero exit code

func (*Logger) Info

func (l *Logger) Info(s string)

Info logs a message with level `info`

func (*Logger) SetLevel

func (l *Logger) SetLevel(level string)

SetLevel sets the level of the logger

func (*Logger) Warn

func (l *Logger) Warn(s string)

Warn logs a message with level `warning`

func (*Logger) With

func (l *Logger) With(params LogParams) *Logger

With returns a logger initialized with the parameters

Jump to

Keyboard shortcuts

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