Code Monkey home page Code Monkey logo

Comments (8)

tolien avatar tolien commented on July 17, 2024 6

Colour (!) me interested in this too - like @Dango-rs, I'm moving from another log framework which exposed this feature and this would be nice to have.
If there's interest in taking it, I could look at putting together a PR to implement it?

I'm thinking I'd want to look at adding some sort of mapping from level to colour in PatternEncoder as a first step, then expose that as a configuration item. It feels like it would be too much to try to shoehorn into the pattern itself though, so (using the example YAML config) I'd do something like this:

  # An appender named "stdout" that writes to stdout
  stdout:
    kind: console
    encoder:
      pattern: "{d} {h({l})} {m}{n}"
      level_colors:
        INFO: Green
        WARN: Yellow
        ERROR: Red

Then go from those strings to Color values, using no colour where there's no match (so, for example, if I do TRACE: DeepPurple, that gets ignored).

Does that all seem reasonable?

from log4rs.

Dango-rs avatar Dango-rs commented on July 17, 2024 4

I recently moved to this crate due to the support of both console and file logging and I can confirm that the blue color is really unreadable on my term as well with default color settings, so i don't believe this matter should be closed.

The colors should either be updated with the same as env_logger (I was previously using that crate) or they should have the ability to be configurable. So far I didn't found any functionality how can I configure the colors from the builder.

from log4rs.

dbrgn avatar dbrgn commented on July 17, 2024

Right now the dark blue color (info level) is really hard to read on a black background.

It would be great if the defaults were improved for legibility, or if the colors could be made configurable.

from log4rs.

sfackler avatar sfackler commented on July 17, 2024

Your terminal controls what the colors look like: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

from log4rs.

dbrgn avatar dbrgn commented on July 17, 2024

Yes, but dark blue is pretty dark on most systems. Cyan as a default might be easier to read. Or a blueish color in 256-color mode.

from log4rs.

sfackler avatar sfackler commented on July 17, 2024

Ah, gotcha. I pulled the color selection from https://logback.qos.ch/manual/layouts.html#coloring but don't feel particularly strongly about the specifics.

from log4rs.

estk avatar estk commented on July 17, 2024

Does anyone still care about this? I'm going to close if not.

from log4rs.

cavivie avatar cavivie commented on July 17, 2024

consider add support for level color, just like this: ColoredLevelConfig

from log4rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.