log

package
v0.0.0-...-62bb9e5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	BOLD = "\033[1m"
	DIM  = "\033[2m"

	RED    = "\033[31m"
	GREEN  = "\033[32m"
	BLUE   = "\033[34m"
	YELLOW = "\033[33m"

	FG_BLACK = "\033[30m"
	FG_WHITE = "\033[97m"

	BG_DGRAY  = "\033[100m"
	BG_RED    = "\033[41m"
	BG_GREEN  = "\033[42m"
	BG_YELLOW = "\033[43m"
	BG_LBLUE  = "\033[104m"

	RESET = "\033[0m"
)

https://misc.flogisoft.com/bash/tip_colors_and_formatting

View Source
const (
	DEBUG = iota
	INFO
	IMPORTANT
	WARNING
	ERROR
	FATAL
)

log level constants

Variables

View Source
var (
	WithColors = true
	Output     = os.Stdout
	StdoutFile = "/dev/stdout"
	DateFormat = "2006-01-02 15:04:05"
	MinLevel   = INFO
)

Functions

func Blue

func Blue(s string) string

Blue blues the text

func Bold

func Bold(s string) string

Bold bolds a text

func Close

func Close()

Close closes the current output file descriptor

func Debug

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

Debug is the log level for debugging purposes

func Dim

func Dim(s string) string

Dim dims a text

func Error

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

Error is the log level for errors that should be corrected

func Fatal

func Fatal(format string, args ...interface{})

Fatal is the log level for errors that must be corrected before continue

func GetLogLevel

func GetLogLevel() int

GetLogLevel returns the current log level configured.

func Green

func Green(s string) string

Green greens the text

func Important

func Important(format string, args ...interface{})

Important is the log level for things that must pay attention

func Info

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

Info is the log level for informative messages

func Log

func Log(level int, format string, args ...interface{})

Log prints out a text with the given color and format

func OpenFile

func OpenFile(logFile string) (err error)

OpenFile opens a file to print out the logs

func Raw

func Raw(format string, args ...interface{})

Raw prints out a text without colors

func Red

func Red(s string) string

Red reds the text

func SetLogLevel

func SetLogLevel(newLevel int)

SetLogLevel sets the log level

func Warning

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

Warning is the log level for non-critical errors

func Wrap

func Wrap(s, effect string) string

Wrap wraps a text with effects

func Yellow

func Yellow(s string) string

Yellow yellows the text

Types

type Handler

type Handler func(format string, args ...interface{})

Jump to

Keyboard shortcuts

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