logger

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: BSD-2-Clause Imports: 12 Imported by: 0

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 CustomMessageLoggerWithSentryDSN added in v1.0.2

func CustomMessageLoggerWithSentryDSN(dsn string) *messageLogger

func CustomStdLoggerWithSentryDSN added in v1.0.2

func CustomStdLoggerWithSentryDSN(dsn string) *stdLogger

func InitServLogger

func InitServLogger(allowFileLogger bool)

func InitServLoggerWithSentryDSN added in v1.0.2

func InitServLoggerWithSentryDSN(allowFileLogger bool, dsn string)

func NewAppLogService

func NewAppLogService(config *Config) *stdLogger

func NewMessageLogService

func NewMessageLogService(config *Config) *messageLogger

Types

type Config

type Config struct {
	DefaultLevel string
	BasePrefix   string
	SentryDSN    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