logger

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package logger provides a simple logging package.

Index

Constants

View Source
const (
	LEVEL_NOSET = iota
	LEVEL_DEBUG
	LEVEL_INFO
	LEVEL_WARNING
	LEVEL_ERROR
	LEVEL_FATAL
	LEVEL_SUCCESS
)
View Source
const (
	FatalEmoji   = "☠️"
	DebugEmoji   = "🐞"
	InfoEmoji    = "🦋"
	SuccessEmoji = "🎉"
	ErrorEmoji   = "💔"
	WarningEmoji = "⚠️"
)

This is the set of emoji definition.

Variables

View Source
var (

	// Level defines the level of the logger. It's a global option and affects
	Level = LEVEL_NOSET

	FilelineFlag = false
	//TimeStamps defines if the output has timestamps or not. It's a global option and affects all methods.
	TimeStamps = true
	// Color defines if the output has color or not. It's a global option and affects all methods.
	Color = true
	// BackgroundColor defines if the output has background color or not. It's a global option and affects all methods.
	BackgroundColor = false
)

It contains configuration of logger.

Functions

func Debug

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

Debug formats according to a format specifier and writes to standard output.

func Error

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

Error formats according to a format specifier and writes to standard output.

func Fatal

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

Fatal formats according to a format specifier and writes to standard output.

func Info

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

Info formats according to a format specifier and writes to standard output.

func InitAndCloseOther

func InitAndCloseOther()

InitLogger initializes the logger

func Success

func Success(format string, a ...interface{})

Success formats according to a format specifier and writes to standard output.

func Warning

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

Warning formats according to a format specifier and writes to standard output.

Types

type CompatLogger

type CompatLogger struct {
	PrefixLevel  int
	Level        int
	FilelineFlag bool
}

func (*CompatLogger) Debugf

func (l *CompatLogger) Debugf(format string, a ...interface{})

Debug formats according to a format specifier and writes to standard output.

func (*CompatLogger) Errorf

func (l *CompatLogger) Errorf(format string, a ...interface{})

Error formats according to a format specifier and writes to standard output.

func (*CompatLogger) Fatalf

func (l *CompatLogger) Fatalf(format string, a ...interface{})

Fatal formats according to a format specifier and writes to standard output.

func (*CompatLogger) Infof

func (l *CompatLogger) Infof(format string, a ...interface{})

func (*CompatLogger) Successf

func (l *CompatLogger) Successf(format string, a ...interface{})

Success formats according to a format specifier and writes to standard output.

func (*CompatLogger) Warningf

func (l *CompatLogger) Warningf(format string, a ...interface{})

Warning formats according to a format specifier and writes to standard output.

Jump to

Keyboard shortcuts

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