logger

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZAP    string = "zap"
	LOGRUS string = "logrus"
)

Log Driver Type

Variables

This section is empty.

Functions

func Init

func Init(opt *Option) error

Init ...

func RegisterLogBuilder

func RegisterLogBuilder(builderType string, builder LogBuilder)

RegisterLogBuilder register all kinds of log builder

Types

type LogBuilder

type LogBuilder interface {
	Build(opt *Option) (Logger, error)
}

LogBuilder for build logger interface

type Logger

type Logger interface {
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Debug(args ...interface{})

	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Debugf(format string, args ...interface{})
}

Logger for common interface

func Build

func Build(opt *Option) (Logger, error)

Build get log factory and make logger instance

type Option

type Option struct {
	Code      string `json:"code,omitempty" yaml:"code,omitempty"`
	Level     string `json:"level,omitempty" yaml:"level,omitempty"`
	AddCaller bool   `json:"addCaller,omitempty" yaml:"addCaller,omitempty"`
}

Option ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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