mallogger

package
Version: v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimeFormat is timestamp format for log.
	TimeFormat = "2006/01/02 15:04:05.000"
	// SuccessIcon is success log indicator.
	SuccessIcon = "[S]"
	// SuccessType is key to write success log.
	SuccessType = "success"
	// TraceIcon is trace log indicator.
	TraceIcon = "[T]"
	// TraceType is key to write trace log.
	TraceType = "trace"
	// DebugIcon is debug log indicator.
	DebugIcon = "[D]"
	// DebugType is key to write debug log.
	DebugType = "debug"
	// InfoIcon is info log indicator.
	InfoIcon = "[I]"
	// InfoType is key to write info log.
	InfoType = "info"
	// WarnIcon is warning log indicator.
	WarnIcon = "[W]"
	// WarnType is key to write warn log.
	WarnType = "warn"
	// ErrorIcon is error log indicator.
	ErrorIcon = "[E]"
	// ErrorType is key to write error log.
	ErrorType = "error"
	// FatalIcon is fatal error log indicator.
	FatalIcon = "[F]"
	// FatalType is key to write fatal log.
	FatalType = "fatal"
	// LevelZero is no log level.
	LevelZero = 0
	// LevelHigh is log level showing Error and Fatal.
	LevelHigh = 1
	// LevelNormal is log level showing Info, Error, and Fatal.
	LevelNormal = 2
	// LevelDebug is log level showing Debug, Info, Warn, Error, and Fatal.
	LevelDebug = 3
	// LevelComplete is log level showing all type of log.
	LevelComplete = 4
	// DefaultLevel is default log level.
	DefaultLevel = LevelNormal
)
View Source
const (
	Reset         = "\033[0m"
	Red           = "\033[31m"
	Green         = "\033[32m"
	Yellow        = "\033[33m"
	Blue          = "\033[34m"
	Magenta       = "\033[35m"
	Cyan          = "\033[36m"
	White         = "\033[37m"
	BrightBlack   = "\033[90m"
	BrightRed     = "\033[91m"
	BrightGreen   = "\033[92m"
	BrightYellow  = "\033[93m"
	BrightBlue    = "\033[94m"
	BrightMagenta = "\033[95m"
	BrightCyan    = "\033[96m"
	BrightWhite   = "\033[97m"
)

Foreground text colors. The output colors may vary on different OS. Taken from https://en.wikipedia.org/wiki/ANSI_escape_code.

Variables

This section is empty.

Functions

func Debug

func Debug(text string)

Debug to write debug log in console/terminal.

func Error

func Error(text string)

Error to write error log in console/terminal.

func Fatal

func Fatal(text string)

Fatal to write fatal error log in console/terminal.

func Info

func Info(text string)

Info to write info log in console/terminal.

func Log

func Log(logType string, text string, logLevel ...int)

Log is shorter function name of LogWithLevel.

func LogFmt

func LogFmt(text ...string) string

LogFmt to create string with format for log.

func LogWithBool

func LogWithBool(logType string, text string, isNeeded ...bool)

LogWithBool is helper function for easier call for all log depends on the boolean (isNeeded). Not writing log by default.

func LogWithLevel

func LogWithLevel(logType string, text string, logLevel ...int)

LogWithLevel is helper function for easier call for all log depends on log level. Default is writing Info, Error, and Fatal log.

func Print

func Print(textColor ...string)

Print to print colored text in console/terminal.

func Println

func Println(textColor ...string)

Println to print colored text with new line in console/terminal.

func Success

func Success(text string)

Success to write success log in console/terminal.

func Test

func Test()

Test to test all available colored text.

func Trace

func Trace(text string)

Trace to write trace log in console/terminal.

func Warn

func Warn(text string)

Warn to write warning log in console/terminal.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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