logger

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ELK_STRATEGY      LoggingStrategy = "ELK_STRATEGY"
	FILE_ELK_STRATEGY                 = "FILE_ELK_STRATEGY"
	CONSOLE_STRATEGY                  = "CONSOLE_STRATEGY"
	FILE_STRATEGY                     = "FILE_STRATEGY"
)

Variables

View Source
var (
	// DefaultLogLevels is the log levels for which errors are reported by Hook, if Hook.LogLevels is not set.
	DefaultLogLevels = []logrus.Level{
		logrus.PanicLevel,
		logrus.FatalLevel,
		logrus.ErrorLevel,
		logrus.WarnLevel,
		logrus.InfoLevel,
		logrus.DebugLevel,
		logrus.TraceLevel,
	}
)

Functions

func NewWithLogger

func NewWithLogger(logger logrus.FieldLogger) *gormLogger

NewWithLogger Create new logger with custom logger

func NewWithNameAndLogger

func NewWithNameAndLogger(name string, logger logrus.FieldLogger) *gormLogger

NewWithNameAndLogger Create new logger with custom name and logger

func ParseFunctionName

func ParseFunctionName(
	pc uintptr,
) (categoryName string, functionName string)

func SetupLogrusToConsole

func SetupLogrusToConsole(log *logrus.Logger)

func SetupLogrusToFile

func SetupLogrusToFile(log *logrus.Logger, url string)

Types

type ELKLogrusHook

type ELKLogrusHook struct {
	LogLevels  []logrus.Level
	HttpClient *resty.Client
	Url        string
	Formatter  *logrus.JSONFormatter
}

func NewELKLogrusHook

func NewELKLogrusHook(Url string) ELKLogrusHook

func (ELKLogrusHook) Fire

func (this ELKLogrusHook) Fire(entry *logrus.Entry) error

Fire reports the log entry as an error to the APM Server.

func (ELKLogrusHook) Levels

func (this ELKLogrusHook) Levels() []logrus.Level

type Logger

type Logger struct {
	Component  string
	RLog       logrus.FieldLogger
	Strategy   LoggingStrategy
	ElasticUrl string
}

func (*Logger) Out

func (this *Logger) Out() (out *io.Writer)

type LoggingStrategy

type LoggingStrategy string

Jump to

Keyboard shortcuts

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