{"repo":"cappuccinotm/slogx","free":true,"listed":false,"github":"https://github.com/cappuccinotm/slogx","clone":"git clone https://github.com/cappuccinotm/slogx.git","description":"slog logger extensions","language":"Go","stars":19,"topics":["go","golang","logging","slog"],"license":"MIT","category":"analytics","readme_excerpt":"slogx Package slogx contains extensions for standard library's slog package. Install Handlers - slogx.Accumulator(slog.Handler) slog.Handler - returns a handler that accumulates attributes and groups from the WithGroup and WithAttrs calls, to pass them to the underlying handler only on Handle call. Allows middlewares to capture the handler-level attributes and groups, but may be consuming. - slogx.NopHandler() slog.Handler - returns a handler that does nothing. Can be used in tests, to disable logging. - slog.Chain - chains the multiple \"middlewares\" - handlers, which can modify the log entry. - slogt.TestHandler - returns a handler that logs the log entry through testing.T 's Log function. It will shorten attributes, so the output will be more readable. - fblog.Handler - a handler that logs the log entry in the fblog-like format, like: Some benchmarks (though this handler wasn't designed for performance, but for comfortable reading of the logs in debug/local mode): All the benchmarks were run on a MacBook Pro (14-inch, 2021) with Apple M1 processor, the benchmark contains the only log lg.Info(\"message\", slog.Int(\"int\", 1)) Middlewares - slogm.RequestID() - adds a request ID to the context and logs it. - slogm.ContextWithRequestID(ctx context.Context, requestID string) context.Context - adds a request ID to the context. - slogm.StacktraceOnError() - adds a stacktrace to the log entry if log entry's level is ERROR. - slogm.TrimAttrs(limit int) - trims the length of the attribu","default_branch":null,"files":null,"tree":[],"storefront":"/r/cappuccinotm","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/cappuccinotm/slogx/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}