console-slog icon indicating copy to clipboard operation
console-slog copied to clipboard

A handler for slog that prints colorized logs, similar to zerolog's console writer output without sacrificing performances

Results 18 console-slog issues
Sort by recently updated
recently updated
newest added

I have an object with a `*time.Time` field that's sometimes filled in and sometimes not. When trying to log it with a call like this: ``` logger.Info("Object created", "expiration", object.Expiration,...

I kept going in circles with the figuring out the optimal combination of headers, fixed size headers, and how to handle the source field. So I decided to instead implement...

I honestly don't expect this PR to be accepted. I'm pretty sure I'm the only person who thinks this is useful. Plus it's not thread safe. Fortunately for me, I...

This is a variant of #19 that removes the need to store state data in the console handler. It's actually pretty much what I originally intended to build before I...

Currently, it works with standard string formatter: ```go testMap := map[string]any{ "key1": "value1", "key2": "value2", } logger.Info("message", slog.Any("test", testMap)) logger.Info("message", slog.Any("test", TestMap{Key1: "value1", Key2: "value2"})) ``` ``` 2025-01-30 12:31:23 INF...

Only make the source file path relative to the current working directly *if* the source file is a child path of the current working directory. Typically, the source file path...

If AddSource=true, the source field in the log is a relative file name, relative to the current working directory. That does work ok when this handler is used in code...

When an attr value has newlines in it, it can make the value of the attr a little hard to scan. For example, in the below output, consider the "errorVerbose"...

Headers are optional attributes removed from the end of the line, and injected (values only) into the header of the line, after the level/source, and before the message. Addresses #6...

Sort multiline attr values to the end, and add newlines to the beginning and end of the value, so the value is printed completely on its own lines, e.g. :...