logrus

package module
v0.0.0-...-c228f2a Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OtelSeverityText

func OtelSeverityText(lv logrus.Level) string

OtelSeverityText convert logrus level to otel severityText ref to https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#severity-fields

Types

type Logger

type Logger = hertzlogrus.Logger

Logger an alias to github.com/stonebirdjx/logger/logrus Logger

func NewLogger

func NewLogger(opts ...Option) *Logger

NewLogger create logger with otel hook

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option logrus hook option

func WithHook

func WithHook(hook logrus.Hook) Option

WithHook configures hook

func WithLogger

func WithLogger(logger *logrus.Logger) Option

WithLogger configures logger

func WithRecordStackTraceInSpan

func WithRecordStackTraceInSpan(recordStackTraceInSpan bool) Option

WithRecordStackTraceInSpan configures whether record stack trace in span

func WithTraceHookConfig

func WithTraceHookConfig(hookConfig *TraceHookConfig) Option

WithTraceHookConfig configures trace hook config

func WithTraceHookErrorSpanLevel

func WithTraceHookErrorSpanLevel(level logrus.Level) Option

WithTraceHookErrorSpanLevel configures trace hook error span level

func WithTraceHookLevels

func WithTraceHookLevels(levels []logrus.Level) Option

WithTraceHookLevels configures hook levels

type TraceHook

type TraceHook struct {
	// contains filtered or unexported fields
}

TraceHook trace hook

func NewTraceHook

func NewTraceHook(cfg *TraceHookConfig) *TraceHook

NewTraceHook create trace hook

func (*TraceHook) Fire

func (h *TraceHook) Fire(entry *logrus.Entry) error

Fire logrus hook fire

func (*TraceHook) Levels

func (h *TraceHook) Levels() []logrus.Level

Levels get levels

type TraceHookConfig

type TraceHookConfig struct {
	// contains filtered or unexported fields
}

TraceHookConfig trace hook config

Jump to

Keyboard shortcuts

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