-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hello, I've just come across this library and it is almost perfect for my needs, but I have a few features I'd like to add.
For now I'll list them all here, in my rough priority order, and I'm happy to implement them myself as PRs if you like the features
-
Add an exported func to be able to set a new level color for Development mode #3 Customized colors/add colors for new log levels
Although slog doesn't have a TRACE level (lower than debug) the project I am integrating with uses hashicorp's hclog which does, and I'd like this level to be colored differently to DEBUG.
-
Space around keys in dev mode
Rather that this:
2025-09-25T10:57:10.232+01:00 INFO test {"logger":"test","time":"abc","http":{"other":"value"}}I'd like it to look something like this
2025-09-25T10:57:10.232+01:00 INFO test {"logger": "test", "time": "abc", "http":{ "other": "value" }} -
Non-JSON mode for attrs in dev mode
This one I'm less set on/wouldn't be that upset if you said no to, but I'd like the ability for a non JSON mode too:
2025-09-25T10:57:10.232+01:00 INFO test logger=test time=abc http.other=value
Thoughts? For 2 and 3 they would be new options in the Config struct, 1 could be there, or could be a global thing.
-
Set/override names for custom logging levels
An extension to the above, when using a level that isn't one of the standard levels from slog.Level, it would be nice to be able to set the level name. For example if I have:
LevelTrace = slog.LevelDebug -4
This will print it as either
DEBUG-4or{"level":"DEBUG-4"}which is not all that helpful. (This applies to both development and non developmnent modes.)