log

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package's name is intended as "log" as remainder to user to use log level than normal one.

Index

Constants

View Source
const (
	// Vendors
	ZEROLOG Vendor = "zerolog"

	// Support
	DEF_CALLER_SKIP int = 3
)

Variables

View Source
var (
	ERR_INVALID_VENDOR = errors.New("invalid vendor")
	ERR_MISSING_CONFIG = errors.New("config is missing")
)

Errors

Functions

func Debug

func Debug(msg string) error

Debug from global.

func DebugKV

func DebugKV(msg string, kv map[string]interface{}) error

DebugKV from global.

func Debugf

func Debugf(msg string, args ...interface{}) error

Debugf from global.

func Error

func Error(msg string) error

Error from global.

func ErrorKV

func ErrorKV(msg string, kv map[string]interface{}) error

ErrorKV from global.

func Errorf

func Errorf(msg string, args ...interface{}) error

Errorf from global.

func Fatal

func Fatal(msg string) error

Fatal from global.

func FatalKV

func FatalKV(msg string, kv map[string]interface{}) error

FatalKV from global.

func Fatalf

func Fatalf(msg string, args ...interface{}) error

Fatalf from global.

func Info

func Info(msg string) error

Info from global.

func InfoKV

func InfoKV(msg string, kv map[string]interface{}) error

InfoKV from global.

func Infof

func Infof(msg string, args ...interface{}) error

Infof from global.

func NewGlobal

func NewGlobal(v Vendor, conf Config) error

NewGlobal provides same usecase with New but will set the result into global so user can directly call the function.

func Panic

func Panic(msg string) error

Panic from global.

func PanicKV

func PanicKV(msg string, kv map[string]interface{}) error

PanicKV from global.

func Panicf

func Panicf(msg string, args ...interface{}) error

Panicf from global.

func Trace

func Trace(msg string) error

Trace from global.

func TraceKV

func TraceKV(msg string, kv map[string]interface{}) error

TraceKV from global.

func Tracef

func Tracef(msg string, args ...interface{}) error

Tracef from global.

func Warn

func Warn(msg string) error

Warn from global.

func WarnKV

func WarnKV(msg string, kv map[string]interface{}) error

WarnKV from global.

func Warnf

func Warnf(msg string, args ...interface{}) error

Warnf from global.

Types

type Config

type Config struct {
	Zerolog *Zerolog
	// contains filtered or unexported fields
}

Config provides list of log's vendor that can be used. It will prioritize from top to bottom and only choose one.

type Log

type Log interface {
	Panic(msg string) error
	Panicf(msg string, args ...interface{}) error
	PanicKV(msg string, kv map[string]interface{}) error

	Fatal(msg string) error
	Fatalf(msg string, args ...interface{}) error
	FatalKV(msg string, kv map[string]interface{}) error

	Error(msg string) error
	Errorf(msg string, args ...interface{}) error
	ErrorKV(msg string, kv map[string]interface{}) error

	Warn(msg string) error
	Warnf(msg string, args ...interface{}) error
	WarnKV(msg string, kv map[string]interface{}) error

	Info(msg string) error
	Infof(msg string, args ...interface{}) error
	InfoKV(msg string, kv map[string]interface{}) error

	Debug(msg string) error
	Debugf(msg string, args ...interface{}) error
	DebugKV(msg string, kv map[string]interface{}) error

	Trace(msg string) error
	Tracef(msg string, args ...interface{}) error
	TraceKV(msg string, kv map[string]interface{}) error
}

Log provides list of standard's log functions.

func New

func New(v Vendor, conf Config) (log Log, err error)

New creates a log base on selected vendor.

type Vendor

type Vendor string

Alias

type Zerolog

type Zerolog struct {
	LogLevel   LogLevel
	UseColor   bool
	TimeFormat string
	// contains filtered or unexported fields
}

Zerolog is config for zerolog's log.

func (*Zerolog) Debug

func (lg *Zerolog) Debug(msg string) error

Debug from Zerolog.

func (*Zerolog) DebugKV

func (lg *Zerolog) DebugKV(msg string, kv map[string]interface{}) error

DebugKV from Zerolog.

func (*Zerolog) Debugf

func (lg *Zerolog) Debugf(msg string, args ...interface{}) error

Debugf from Zerolog + fmt.Sprintf.

func (*Zerolog) Error

func (lg *Zerolog) Error(msg string) error

Error from Zerolog.

func (*Zerolog) ErrorKV

func (lg *Zerolog) ErrorKV(msg string, kv map[string]interface{}) error

ErrorKV from Zerolog.

func (*Zerolog) Errorf

func (lg *Zerolog) Errorf(msg string, args ...interface{}) error

Errorf from Zerolog + fmt.Sprintf.

func (*Zerolog) Fatal

func (lg *Zerolog) Fatal(msg string) error

Fatal from Zerolog.

func (*Zerolog) FatalKV

func (lg *Zerolog) FatalKV(msg string, kv map[string]interface{}) error

FatalKV from Zerolog.

func (*Zerolog) Fatalf

func (lg *Zerolog) Fatalf(msg string, args ...interface{}) error

Fatalf from Zerolog + fmt.Sprintf.

func (*Zerolog) Info

func (lg *Zerolog) Info(msg string) error

Info from Zerolog.

func (*Zerolog) InfoKV

func (lg *Zerolog) InfoKV(msg string, kv map[string]interface{}) error

InfoKV from Zerolog.

func (*Zerolog) Infof

func (lg *Zerolog) Infof(msg string, args ...interface{}) error

Infof from Zerolog + fmt.Sprintf.

func (*Zerolog) Panic

func (lg *Zerolog) Panic(msg string) error

Panic from Zerolog.

func (*Zerolog) PanicKV

func (lg *Zerolog) PanicKV(msg string, kv map[string]interface{}) error

PanicKV from Zerolog.

func (*Zerolog) Panicf

func (lg *Zerolog) Panicf(msg string, args ...interface{}) error

Panicf from Zerolog + fmt.Sprintf.

func (*Zerolog) Trace

func (lg *Zerolog) Trace(msg string) error

Trace from Zerolog.

func (*Zerolog) TraceKV

func (lg *Zerolog) TraceKV(msg string, kv map[string]interface{}) error

TraceKV from Zerolog.

func (*Zerolog) Tracef

func (lg *Zerolog) Tracef(msg string, args ...interface{}) error

Tracef from Zerolog + fmt.Sprintf.

func (*Zerolog) Warn

func (lg *Zerolog) Warn(msg string) error

Warn from Zerolog.

func (*Zerolog) WarnKV

func (lg *Zerolog) WarnKV(msg string, kv map[string]interface{}) error

WarnKV from Zerolog + fmt.Sprintf.

func (*Zerolog) Warnf

func (lg *Zerolog) Warnf(msg string, args ...interface{}) error

Warnf from Zerolog + fmt.Sprintf.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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