logger

package
v0.0.0-...-c02a6a4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(message string, err error)

func Fatal

func Fatal(message string, err error)

func Info

func Info(message string)

func Panic

func Panic(message string, err error)

func Warning

func Warning(message string)

Types

type Config

type Config struct {
	// App name
	App string `json:"app"`

	// App Version
	AppVer string `json:"appVer"`

	// Log environment (development or production)
	Env string `json:"env"`

	// Location where the system log will be saved
	FileLocation string `json:"fileLocation"`

	// Location where the tdr log will be saved
	FileTDRLocation string `json:"fileTDRLocation"`

	// Maximum size of a single log file.
	// If the capacity reach, file will be saved but it will be renamed
	// with suffix the current date
	FileMaxSize int `json:"fileMaxSize"`

	// Maximum number of backup file that will not be deleted
	FileMaxBackup int `json:"fileMaxBackup"`

	// Number of days where the backup log will not be deleted
	FileMaxAge int `json:"fileMaxAge"`

	// Log will be printed in console if the value is true
	Stdout bool `json:"stdout"`
}

type Log

type Log interface {
	Info(message string)
	Warning(message string)
	Error(message string, err error)
	Fatal(message string, err error)
	Panic(message string, err error)
}

func Load

func Load(conf Config) Log

type Logger

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

func NewLogger

func NewLogger(conf Config) *Logger

func (*Logger) Error

func (l *Logger) Error(message string, err error)

func (*Logger) Fatal

func (l *Logger) Fatal(message string, err error)

func (*Logger) Info

func (l *Logger) Info(message string)

func (*Logger) Panic

func (l *Logger) Panic(message string, err error)

func (*Logger) Warning

func (l *Logger) Warning(message string)

Jump to

Keyboard shortcuts

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