abslog

package module
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: GPL-3.0 Imports: 10 Imported by: 3

README

abslog

Library that abstracts it from the log library used behind

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug func(args ...interface{})

Debug logs a message at level Debug on the standard logger.

View Source
var DebugCtx func(ctx context.Context, args ...interface{})
View Source
var DebugCtxf func(ctx context.Context, format string, args ...interface{})
View Source
var Debugf func(format string, args ...interface{})
View Source
var Error func(args ...interface{})

Error logs a message at level Error on the standard logger.

View Source
var ErrorCtx func(ctx context.Context, args ...interface{})
View Source
var ErrorCtxf func(ctx context.Context, format string, args ...interface{})
View Source
var Errorf func(format string, args ...interface{})
View Source
var Fatal func(args ...interface{})

Fatal logs a message at level Fatal on the standard logger.

View Source
var FatalCtx func(ctx context.Context, args ...interface{})
View Source
var FatalCtxf func(ctx context.Context, format string, args ...interface{})
View Source
var Fatalf func(format string, args ...interface{})
View Source
var Info func(args ...interface{})

Info logs a message at level Info on the standard logger.

View Source
var InfoCtx func(ctx context.Context, args ...interface{})
View Source
var InfoCtxf func(ctx context.Context, format string, args ...interface{})
View Source
var Infof func(format string, args ...interface{})
View Source
var Panic func(args ...interface{})

Panic logs a message at level Panic on the standard logger.

View Source
var PanicCtx func(ctx context.Context, args ...interface{})
View Source
var PanicCtxf func(ctx context.Context, format string, args ...interface{})
View Source
var Panicf func(format string, args ...interface{})
View Source
var Warn func(args ...interface{})

Warn logs a message at level Warn on the standard logger.

View Source
var WarnCtx func(ctx context.Context, args ...interface{})
View Source
var WarnCtxf func(ctx context.Context, format string, args ...interface{})
View Source
var Warnf func(format string, args ...interface{})

Functions

func GetCtxKey

func GetCtxKey() string

func SetCtxKey

func SetCtxKey(key string)

func SetCtxSeparator

func SetCtxSeparator(separator string)

func SetLogger

func SetLogger(logger AbsLog)

func SetLoggerType

func SetLoggerType(typ LoggerType)

Types

type AbsLog

type AbsLog interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})

	Info(args ...interface{})
	Infof(format string, args ...interface{})

	Warn(args ...interface{})
	Warnf(format string, args ...interface{})

	Error(args ...interface{})
	Errorf(format string, args ...interface{})

	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})

	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
}

type AbsLogBuilder

type AbsLogBuilder interface {
	LogLevel(level LogLevel) AbsLogBuilder
	LoggerGen(generator LoggerGen) AbsLogBuilder
	LoggerType(loggerType LoggerType) AbsLogBuilder
	EncoderType(encoderType EncoderType) AbsLogBuilder
	BuildAndSetAsGlobal() AbsLog
	Build() AbsLog
}

AbsLogBuilder is the interface that wraps the Builder methods to create a new AbsLog.

func GetAbsLogBuilder

func GetAbsLogBuilder() AbsLogBuilder

GetAbsLogBuilder returns a new AbsLog builder.

type EncoderType

type EncoderType int8
const (
	ConsoleEncoder EncoderType = iota + 1
	JSONEncoder
)

type LogLevel

type LogLevel int8
const (
	DebugLevel LogLevel = iota + 1
	InfoLevel
	WarnLevel
	ErrorLevel
	PanicLevel
	FatalLevel
)

type LoggerGen

type LoggerGen func(logLevel LogLevel, encoder EncoderType) AbsLog

type LoggerType

type LoggerType int8
const (
	ZapLogger LoggerType = iota + 1
	LogrusLogger
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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