mallogger

package
v0.3.18 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 3 Imported by: 3

Documentation

Overview

Package mallogger provides simple log printing with customizable color and level.

Index

Constants

View Source
const (
	// LevelZero is no log level.
	LevelZero = iota
	// LevelHigh is log level showing Error and Fatal.
	LevelHigh
	// LevelNormal is log level showing Info, Error, and Fatal.
	LevelNormal
	// LevelDebug is log level showing Debug, Info, Warn, Error, and Fatal.
	LevelDebug
	// LevelComplete is log level showing all type of log.
	LevelComplete
)
View Source
const (
	TypeTrace = iota
	TypeDebug
	TypeInfo
	TypeWarn
	TypeError
	TypeFatal
)

Log types.

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

This section is empty.

Types

type Log

type Log struct {
	// contains filtered or unexported fields
}

Log is log.

func New

func New(level int, useColor bool) Log

New to create new log.

func (Log) Debug

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

Debug to log debug.

func (Log) Error

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

Error to log error.

func (Log) Fatal

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

Fatal to log trace.

func (Log) Info

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

Info to log info.

func (Log) Print

func (l Log) Print(logType int, format string, args ...interface{})

Print is a wrapper to print different type of log.

func (Log) Trace

func (l Log) Trace(format string, args ...interface{})

Trace to log trace.

func (Log) Warn

func (l Log) Warn(format string, args ...interface{})

Warn to log warning.

Jump to

Keyboard shortcuts

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