-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminal coloration #3
Comments
Yep, definitely seems reasonable to implement! I will probably not have a ton of time to work on it, but if you were willing to that'd be great. |
I really like this library but I needed colorization, so I went ahead and hacked in super basic, super dirty functionality. No config or anything, just hard-coded colour values for different log levels. I wrote it for my own use until someone smarter than me found the time to implement a proper solution, but I figured I'd post it here in case it helps. If nobody else finds the time to work on this functionality I might look into cleaning up the code and doing it right. |
Is anyone still working on this? If not, I am willing to pick it up. I will need some pointers on how one would configure this in the .toml file |
I don't think anyone's working on it right now. Logback's pattern syntax might be a place to look for configuration syntax inspiration: http://logback.qos.ch/manual/layouts.html#coloring |
This implementation is based on the prototype provided by @ryantaylor in estk#3. Adds a new color syntax to the pattern parser which looks like this: %c:color(...colored text...) Also changes the default pattern to `%c:highlight(%d %l %t -) %m`. closes estk#3
I've started working on this. |
Progress! The I copied the color selections from logback: intense red for error, red for warning, blue for info, and default for everything else. I'd like to add a pattern formatter or group of them that lets you pick a specific style, but I'm not sure about the syntax right now. |
I've released v0.4.3 with color support. All that the pattern encoder supports right now is level-based styling. I've opened a new issue to figure out syntax for configuration of specific styles: #17 |
Hi! I started using log4s and not seeing any colors in the terminal (I see them e.g. with |
see #204 , its in progress but seems to be stalled |
What's keeping it stalled currently? |
Is there any progress at all @estk ? |
@Creative-Difficulty you may want to try using the formatter As an example, you could use this in your yaml_config: appenders:
# An appender named "stdout" that writes to stdout
stdout:
kind: console
target: stdout
encoder:
pattern: " {h({l:<5}} {M} > {m}{n}"
# Set the default logging level to "warn" and attach the "stdout" appender to the root
root:
level: info
appenders:
- stdout This should look somewhat similar to the output produced by the |
Hello there!
I have realised log4rs does not provide terminal coloration by default. Would you be interested in the feature?
For comparison, loggers such as log4js and winston provides terminal coloration by default.
If you like the idea but don't have the time for it, I would gladly work on it. :)
The text was updated successfully, but these errors were encountered: