logger

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: BSD-2-Clause Imports: 9 Imported by: 2

Documentation

Overview

Logging provider

Log only fully init when app.Run() called

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMessageLogger = NewMessageLogService(&Config{
		BasePrefix:   "core",
		DefaultLevel: "info",
	})
)
View Source
var (
	DefaultStdLogger = NewAppLogService(&Config{
		BasePrefix:   "core",
		DefaultLevel: "trace",
	})
)

Functions

func InitServLogger

func InitServLogger(allowFileLogger bool)

func NewAppLogService

func NewAppLogService(config *Config) *stdLogger

func NewMessageLogService

func NewMessageLogService(config *Config) *messageLogger

Types

type Config

type Config struct {
	DefaultLevel string
	BasePrefix   string
}

type Fields

type Fields logrus.Fields

type Logger

type Logger interface {
	Print(args ...interface{})
	Debug(...interface{})
	Debugln(...interface{})
	Debugf(string, ...interface{})

	Info(...interface{})
	Infoln(...interface{})
	Infof(string, ...interface{})

	Warn(...interface{})
	Warnln(...interface{})
	Warnf(string, ...interface{})

	Error(...interface{})
	Errorln(...interface{})
	Errorf(string, ...interface{})

	Fatal(...interface{})
	Fatalln(...interface{})
	Fatalf(string, ...interface{})

	Panic(...interface{})
	Panicln(...interface{})
	Panicf(string, ...interface{})

	With(key string, value interface{}) Logger
	Withs(Fields) Logger
	// add source field to log
	WithSrc() Logger
	GetLevel() string
}

type ServiceLogger

type ServiceLogger interface {
	GetLogger(prefix string) Logger
}

func GetCurrent

func GetCurrent() ServiceLogger

Jump to

Keyboard shortcuts

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