log

package
v0.7.0-rc2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: Apache-2.0 Imports: 5 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

This section is empty.

Variables

This section is empty.

Functions

func InitLogs

func InitLogs() *logrus.Logger

func Truncate added in v0.6.0

func Truncate(msg string, limit int) string

Truncate truncates a string to the given limit or first newline and adds "..." at the end

func WithReqID

func WithReqID(reqID string, inner logrus.FieldLogger) logrus.FieldLogger

func WithReqIDFromCtx

func WithReqIDFromCtx(ctx context.Context, inner logrus.FieldLogger) logrus.FieldLogger

WithReqIDFromCtx create logger with request id from the context, request id is set by middleware.RequestID

Types

type PrefixFormatter

type PrefixFormatter struct {
	Prefix     string
	CallLevels int
}

func (*PrefixFormatter) Format

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

type PrefixLogger

type PrefixLogger struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

PrefixLogger is wrapper around a logrus with an optional prefix

func NewPrefixLogger

func NewPrefixLogger(prefix string) *PrefixLogger

NewPrefixLogger creates a new PrefixLogger

func (*PrefixLogger) Level

func (p *PrefixLogger) Level(level string)

func (*PrefixLogger) Prefix

func (l *PrefixLogger) Prefix() string

Prefix returns the prefix of the logger

Jump to

Keyboard shortcuts

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