logger

package
v0.0.0-...-f0fcf00 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: GPL-3.0 Imports: 4 Imported by: 2

Documentation

Overview

Utility functions for logging messages and errors

Index

Constants

View Source
const (
	Error   logType = 0
	Warning logType = 1
	Info    logType = 2
	List    logType = 3
	Done    logType = 4
	Debug   logType = 5

	SUCCESS     int = 0
	ERR_GENERIC int = 1
	ERR_UNKNOWN int = 2

	ERR_USAGE     int = 10
	ERR_INPUT     int = 11
	ERR_FILE_READ int = 12
	ERR_CLOSABLE  int = 13

	ERR_CONNECTION int = 30
	ERR_WRITE      int = 31
	ERR_PARSE      int = 32
)

Variables

View Source
var MapTypesToPrefix = map[logType]string{
	Error:   MapTypesToColor[Error].Sprint("[ERR]"),
	Warning: MapTypesToColor[Warning].Sprint("[WRN]"),
	Info:    MapTypesToColor[Info].Sprint("[INF]"),
	List:    MapTypesToColor[List].Sprint("[LST]"),
	Done:    MapTypesToColor[Done].Sprint("[DON]"),
	Debug:   MapTypesToColor[Debug].Sprint("[DBG]"),
}

Functions

func Log

func Log(messageType logType, messages ...string)

Log a timestamped message with a given logType.

func LogError

func LogError(err error)

Log the error string

func LogPlain

func LogPlain(messageType logType, messages ...string)

`Log()` without a timestamp.

func LogReturn

func LogReturn(messageType logType, messages ...string) string

Return the `log()` string instead of printing it.

func Logf

func Logf(messageType logType, format string, data ...interface{})

`Log()` that functions like `fmt.Printf()`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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