logger

package module
v0.0.0-...-116ae15 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 10 Imported by: 0

README

Go Logger

Small Golang package to output alternative logs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogLevelPrintString

func GetLogLevelPrintString(level LogLevel) string

func GetLogLevelString

func GetLogLevelString(level LogLevel) string

Types

type DebugLevel

type DebugLevel int
const (
	DebugLevelVerbose DebugLevel = iota
	DebugLevelInfo
	DebugLevelWarning
	DebugLevelError
)

type LogLevel

type LogLevel int
const (
	LogLevelDebug LogLevel = iota
	LogLevelNotice
	LogLevelInfo
	LogLevelWarning
	LogLevelError
	LogLevelSuccess
)

type Logger

type Logger struct {
	OnLogger func(msg LoggerMessage, raw string)
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(namespace string) *Logger

func (*Logger) Debug

func (c *Logger) Debug(input interface{})

func (*Logger) Error

func (c *Logger) Error(input interface{}) *Logger

func (*Logger) GetLogLevel

func (c *Logger) GetLogLevel() (level DebugLevel)

func (*Logger) GetPrintToConsole

func (c *Logger) GetPrintToConsole() (pr bool)

func (*Logger) Info

func (c *Logger) Info(input interface{})

func (*Logger) Notice

func (c *Logger) Notice(input interface{})

func (*Logger) ParsingLog

func (c *Logger) ParsingLog(msg LoggerMessage) (raw string)

func (*Logger) Quit

func (c *Logger) Quit(err error) error

Quit - force exit application when error is trigger

func (*Logger) SetLogLevel

func (c *Logger) SetLogLevel(level DebugLevel)

func (*Logger) SetOnLoggerHandler

func (c *Logger) SetOnLoggerHandler(f func(msg LoggerMessage, raw string))

func (*Logger) SetPrintToConsole

func (c *Logger) SetPrintToConsole(pr bool)

func (*Logger) Success

func (c *Logger) Success(input interface{})

func (*Logger) Warning

func (c *Logger) Warning(input interface{})

type LoggerMessage

type LoggerMessage struct {
	ID       string      `json:"id"`
	Level    LogLevel    `json:"level"`
	File     string      `json:"file"`
	Line     int         `json:"line"`
	FuncName string      `json:"funcName"`
	Time     int64       `json:"time"`
	Message  interface{} `json:"message"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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