Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(msg string, fields ...zapcore.Field)
- func DebugContext(ctx context.Context, msg string, fields ...zapcore.Field)
- func Error(msg string, fields ...zapcore.Field)
- func ErrorContext(ctx context.Context, msg string, fields ...zapcore.Field)
- func Fatal(msg string, fields ...zapcore.Field)
- func FatalContext(ctx context.Context, msg string, fields ...zapcore.Field)
- func GetDefaultLogger() *otelzap.Logger
- func GetTraceID(ctx context.Context) string
- func Info(msg string, fields ...zapcore.Field)
- func InfoContext(ctx context.Context, msg string, fields ...zapcore.Field)
- func InitLogger(logPath string, level string, opts ...Option)
- func Named(s string) *otelzap.Logger
- func Warn(msg string, fields ...zapcore.Field)
- func WarnContext(ctx context.Context, msg string, fields ...zapcore.Field)
- type Config
- type Option
Constants ¶
const LabelLevel = "level"
Variables ¶
var (
DefaultLogger *otelzap.Logger
)
Functions ¶
func DebugContext ¶ added in v0.0.2
func ErrorContext ¶ added in v0.0.2
func FatalContext ¶ added in v0.0.2
func GetDefaultLogger ¶
func GetTraceID ¶ added in v0.1.0
GetTraceID returns the 32-character lowercase hexadecimal string of the TraceID from the current context. Returns an empty string if there is no Span in the ctx.
func InfoContext ¶ added in v0.0.2
func InitLogger ¶
Types ¶
type Config ¶ added in v0.1.0
type Config struct {
lumberjack.Logger
WithTraceID bool
WithAutoEvents bool
}
type Option ¶ added in v0.0.7
type Option func(c *Config)
func WithAutoEvents ¶ added in v0.1.1
WithAutoEvents configures the logger to automatically add log messages as events to active spans. When enabled, each log call will add an event to the current span with the log level and message.
func WithCompress ¶ added in v0.0.7
func WithMaxBackups ¶ added in v0.0.7
func WithTraceID ¶ added in v0.1.0
WithTraceIDField configures the logger to add `trace_id` field to structured log messages.