logwrap

package
v0.0.0-...-40a7d94 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const WrapDepth__DisablePC = -10000

Variables

This section is empty.

Functions

func Log

func Log(ctx context.Context, handler slog.Handler, wrapDepth int,
	level slog.Level, attrs []any, msg string)

Logs to given slog Handler

func LogAttrs

func LogAttrs(ctx context.Context, handler slog.Handler, wrapDepth int,
	level slog.Level, attrs []slog.Attr, msg string)

Logs to given slog Handler

func PC

func PC(depth int) uintptr

Returns the program counter of the calling goroutine depth will skip a given number of stack frames in the case of func F() any { return PC(0) } will return a location inside of F program counter can be used with logging to translate to a source line

func Record

func Record(wrapDepth int, level slog.Level, msg string) slog.Record

Create record wrapDepth will control how the PC (source line) is resolved wrapDepth defines the number of frames to skip if wrapDepth < 0 then PC is not resolved NOTE: Wrappers will add to wrapDepth without checking it's value, so you should set it to a large negative value, like WrapDepth__DisablePC to disable

Types

This section is empty.

Jump to

Keyboard shortcuts

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