ilog

package
v0.0.2-alpha-test Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	INFO  = 0x1
	WARN  = 0x2
	DEBUG = 0x3
)

Variables

This section is empty.

Functions

func GetEnvLOGLEVEL

func GetEnvLOGLEVEL() int

func GetLOGLEVEL

func GetLOGLEVEL(loglvl string) (retval int)

Types

type ILOG

type ILOG interface {
	LogStart(filename string)
	LogClose()
	Error(format string, args ...any)
	Debug(format string, args ...any)
	Fatal(format string, args ...any)
	Info(format string, args ...any)
	Warn(format string, args ...any)
	GetLOGLEVEL() int
	SetLOGLEVEL(int)
	IfDebug() bool
}

func NewLogger

func NewLogger(lvl int, logfile string) ILOG

type LOG

type LOG struct {
	LogFile  *os.File
	LOGLEVEL int
	// contains filtered or unexported fields
}

func (*LOG) ConfigureFileAndConsoleOutput

func (l *LOG) ConfigureFileAndConsoleOutput()

ConfigureFileAndConsoleOutput configures the logs to write to both a file and console.

func (*LOG) Debug

func (l *LOG) Debug(format string, args ...any)

Debug logs a message at the info level.

func (*LOG) Error

func (l *LOG) Error(format string, args ...any)

Error logs a message at the error level.

func (*LOG) Fatal

func (l *LOG) Fatal(format string, args ...any)

Fatal logs a message at the fatal level, then exits the program.

func (*LOG) GetLOGLEVEL

func (l *LOG) GetLOGLEVEL() int

func (*LOG) IfDebug

func (l *LOG) IfDebug() bool

ilog.IfDebug returns true if LOGLEVEL is DEBUG

func (*LOG) Info

func (l *LOG) Info(format string, args ...any)

Info logs a message at the info level.

func (*LOG) LogClose

func (l *LOG) LogClose()

LogStart opens a log file for writing.

func (*LOG) LogStart

func (l *LOG) LogStart(filename string)

LogStart opens a log file for writing.

func (*LOG) SetLOGLEVEL

func (l *LOG) SetLOGLEVEL(lvl int)

func (*LOG) SetOutput

func (l *LOG) SetOutput(writer io.Writer)

SetOutput sets the output writer for the logs.

func (*LOG) Warn

func (l *LOG) Warn(format string, args ...any)

Warn logs a message at the warn level.

Jump to

Keyboard shortcuts

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