log

package
v0.0.0-...-da9b7ae Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "dify-plugin-daemon"

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

func DebugContext

func DebugContext(ctx context.Context, msg string, args ...any)

func EnsureTrace

func EnsureTrace(ctx context.Context) context.Context

func Error

func Error(msg string, args ...any)

func ErrorContext

func ErrorContext(ctx context.Context, msg string, args ...any)

func GenerateSpanID

func GenerateSpanID() string

func GenerateTraceID

func GenerateTraceID() string

func GetTraceparentHeader

func GetTraceparentHeader(ctx context.Context) string

func Info

func Info(msg string, args ...any)

func InfoContext

func InfoContext(ctx context.Context, msg string, args ...any)

func Init

func Init(json bool)

func LoggerMiddleware

func LoggerMiddleware() gin.HandlerFunc

func LoggerMiddlewareWithConfig

func LoggerMiddlewareWithConfig(config LoggerConfig) gin.HandlerFunc

func Panic

func Panic(msg string, args ...any)

func PanicContext

func PanicContext(ctx context.Context, msg string, args ...any)

func ParseTraceparent

func ParseTraceparent(header string) (traceID, spanID string, ok bool)

func RecoverAndExit

func RecoverAndExit()

func RecoveryMiddleware

func RecoveryMiddleware() gin.HandlerFunc

func TraceMiddleware

func TraceMiddleware() gin.HandlerFunc

func Warn

func Warn(msg string, args ...any)

func WarnContext

func WarnContext(ctx context.Context, msg string, args ...any)

func WithIdentity

func WithIdentity(ctx context.Context, id Identity) context.Context

func WithTrace

func WithTrace(ctx context.Context, tc TraceContext) context.Context

Types

type Handler

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

func NewHandler

func NewHandler(opts Options) *Handler

func (*Handler) Enabled

func (h *Handler) Enabled(_ context.Context, level slog.Level) bool

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, r slog.Record) error

func (*Handler) WithAttrs

func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*Handler) WithGroup

func (h *Handler) WithGroup(name string) slog.Handler

type Identity

type Identity struct {
	TenantID string `json:"tenant_id"`
	UserID   string `json:"user_id"`
	UserType string `json:"user_type"`
}

func IdentityFromContext

func IdentityFromContext(ctx context.Context) (Identity, bool)

type LoggerConfig

type LoggerConfig struct {
	SkipPaths []string
}

type Options

type Options struct {
	Level   slog.Leveler
	Service string
	JSON    bool
	Out     io.Writer
}

type TraceContext

type TraceContext struct {
	TraceID string `json:"trace_id"`
	SpanID  string `json:"span_id"`
}

func TraceFromContext

func TraceFromContext(ctx context.Context) (TraceContext, bool)

Jump to

Keyboard shortcuts

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