internal

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LibraryName      = "chronolog"
	LibraryVersion   = "0.1.0"
	LibraryCommit    = "abc1234def5678ghijkl9012mnop3456"
	LibraryBuildTime = "2023-10-01T12:00:00Z"
)
View Source
const (
	TraceIDKey      contextKey = "trace_id"
	SpanIDKey       contextKey = "span_id"
	ParentSpanIDKey contextKey = "parent_span_id"
	CommitHashKey   contextKey = "commit_hash"
	BuildTimeKey    contextKey = "build_time"
	VersionKey      contextKey = "version"
)

Variables

This section is empty.

Functions

func ClassifyError

func ClassifyError(err error) string

func ExtractBuildTime

func ExtractBuildTime(ctx context.Context) string

func ExtractCommitHash

func ExtractCommitHash(ctx context.Context) string

func ExtractParentSpanID

func ExtractParentSpanID(ctx context.Context) string

func ExtractSpanID

func ExtractSpanID(ctx context.Context) string

func ExtractStackTrace

func ExtractStackTrace(err error) string

func ExtractTraceID

func ExtractTraceID(ctx context.Context) string

func ExtractVersion

func ExtractVersion(ctx context.Context) string

func GetStructName

func GetStructName(i interface{}) string

func MergeAdditionalData

func MergeAdditionalData(data ...map[string]any) map[string]any

func WithBuildTime

func WithBuildTime(ctx context.Context, buildTime string) context.Context

func WithCommitHash

func WithCommitHash(ctx context.Context, commitHash string) context.Context

func WithParentSpanID

func WithParentSpanID(ctx context.Context, parentSpanID string) context.Context

func WithSpanID

func WithSpanID(ctx context.Context, spanID string) context.Context

func WithTraceID

func WithTraceID(ctx context.Context, traceID string) context.Context

func WithVersion

func WithVersion(ctx context.Context, version string) context.Context

Types

type JSONOnlyHandler

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

JSONOnlyHandler is a slog.Handler that prints only the serialized JSON of the "event" field.

func NewJSONOnlyHandler

func NewJSONOnlyHandler(w io.Writer) *JSONOnlyHandler

NewJSONOnlyHandler creates a new JSONOnlyHandler.

func (*JSONOnlyHandler) Enabled

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

func (*JSONOnlyHandler) Handle

func (h *JSONOnlyHandler) Handle(_ context.Context, record slog.Record) error

func (*JSONOnlyHandler) WithAttrs

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

func (*JSONOnlyHandler) WithGroup

func (h *JSONOnlyHandler) WithGroup(_ string) slog.Handler

type PrettyConsoleHandler

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

func NewPrettyConsoleHandler

func NewPrettyConsoleHandler(w io.Writer) *PrettyConsoleHandler

func (*PrettyConsoleHandler) Enabled

func (*PrettyConsoleHandler) Handle

func (h *PrettyConsoleHandler) Handle(_ context.Context, record slog.Record) error

func (*PrettyConsoleHandler) WithAttrs

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

func (*PrettyConsoleHandler) WithGroup

func (h *PrettyConsoleHandler) WithGroup(_ string) slog.Handler

Jump to

Keyboard shortcuts

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