logrusutil

package
v1.33.13 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 1 package

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

Overview

Package logrusutil implements some helpers for using logrus

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComponentInit

func ComponentInit(component string)

ComponentInit is a syntax sugar for easier Init

func CreateDefaultFormatter

func CreateDefaultFormatter() logrus.Formatter

CreateDefaultFormatter creates a default JSON formatter

func Init

func Init(formatter *DefaultFieldsFormatter)

Init set Logrus formatter if DefaultFieldsFormatter.wrappedFormatter is nil &logrus.JSONFormatter{} will be used instead

Types

type DefaultFieldsFormatter

type DefaultFieldsFormatter struct {
	WrappedFormatter logrus.Formatter
	DefaultFields    logrus.Fields
	PrintLineNumber  bool
}

DefaultFieldsFormatter wraps another logrus.Formatter, injecting DefaultFields into each Format() call, existing fields are preserved if they have the same key

func (*DefaultFieldsFormatter) Format

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

Format implements logrus.Formatter's Format. We allocate a new Fields map in order to not modify the caller's Entry, as that is not a thread safe operation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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