wlog

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 5 Imported by: 5

README

WLog

It's a very simple logger, with log levels, the minimum of formatting and allows for dual mode (log to file and STDOUT) to support logging when running as a Docker container.

Usage

Example

// Set up the logging
logFilePath := "mylog.log"
logFile, err := os.OpenFile(logFilePath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
    log.Error("Failed to open log file '%s' with write permissions: %v", logFilePath, err)
    os.Exit(1)
}

log.SetOutput(logFile, true)
log.SetVerbose(true)

// Start using the logger
log.Info("The logger is set up")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(format string, v ...interface{})

Debug adds a log entry with level name DEBUG

func Error

func Error(format string, v ...interface{})

Error adds a log entry with level name ERROR

func Fatal added in v0.0.3

func Fatal(err error)

Fatal adds a log entry with level name FATAL and aborts execution of the application

func Info

func Info(format string, v ...interface{})

Info adds a log entry with level name INFO

func SetOutput

func SetOutput(writer io.Writer, dualMode bool)

SetOutput defines the writer for the log files

func SetVerbose

func SetVerbose(isVerbose bool)

SetVerbose changes the setting whether log entries woth level DEBUG should be printed or not

func Warning

func Warning(format string, v ...interface{})

Warning adds a log entry with level name WARN

Types

This section is empty.

Jump to

Keyboard shortcuts

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