log

package
v1.0.0-helm Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogs

func InitLogs(level ...string) *logrus.Logger

InitLogs creates and configures a logger with the specified level. If no level is provided, defaults to "info".

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 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