logrus

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Credit: https://github.com/banzaicloud/logrus-runtime-formatter

Index

Constants

View Source
const FileKey = "file"

FileKey holds the file field

View Source
const FunctionKey = "function"

FunctionKey holds the function field

View Source
const LineKey = "line"

LineKey holds the line field

View Source
const PackageKey = "package"

PackageKey holds the package field

Variables

This section is empty.

Functions

func New

func New() chassis.Logger

Types

type Formatter

type Formatter struct {
	ChildFormatter logrus.Formatter
	// When true, line number will be tagged to fields as well
	Line bool
	// When true, package name will be tagged to fields as well
	Package bool
	// When true, file name will be tagged to fields as well
	File bool
	// When true, only base name of the file will be tagged to fields
	BaseNameOnly bool
}

Formatter decorates log entries with function name and package name (optional) and line number (optional)

func (*Formatter) Format

func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error)

Format the current log entry by adding the function name and line number of the caller.

type Logger

type Logger interface {
	chassis.Logger
	// Entry returns the underlying logrus.Entry
	Entry() *logrus.Entry
}

Jump to

Keyboard shortcuts

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