Skip to content
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

Logging pattern does not depict logs as I declared it #371

Open
EvilWatermelon opened this issue May 2, 2024 · 3 comments
Open

Logging pattern does not depict logs as I declared it #371

EvilWatermelon opened this issue May 2, 2024 · 3 comments

Comments

@EvilWatermelon
Copy link

EvilWatermelon commented May 2, 2024

I want that my log looks like this:

2024-05-02T10:45:28 [INFO] actix_server::server - Actix runtime found; starting in Actix runtime

But that does not work and looks like this:

2024-05-02T10:45:28.658835804+02:00 INFO actix_server::server - Actix runtime found; starting in Actix runtime

And I also want to use colors but that does not work either. What am I doing wrong?

appenders:
  stdout:
    kind: console
  requests:
    kind: threshhold
    encoder:
      kind: pattern
      pattern: "{h(%Y-%m-%d %H:%M:%S)} | {({l}):5.5} | [{f}:{L}] — {m}{n}"
      level_colors:
        INFO: Green
        WARN: Yellow
        ERROR: Red
        DEBUG: Orange
root:
  level: debug
  appenders:
    - stdout
loggers:
  app::requests:
    level: info
    appenders:
      - requests
    additive: true
@bconn98
Copy link
Collaborator

bconn98 commented May 16, 2024

  1. Colors: We don't yet support modifying the highlight scheme. Here's an old PR that started the process: Adding ability to configure colors for console #224
  2. It looks like the only issue is related to the formatting of seconds? It looks like the crate we use to format time may have had some modifications. I'll take a look.

@bconn98
Copy link
Collaborator

bconn98 commented May 17, 2024

@EvilWatermelon I took a look and chrono has not changed their formatting. I ran some tests and believe "{h({d(%Y-%m-%d %H:%M:%S)} [{l:<5.5}] {M} - {m})}{n}" is the pattern you're looking for. I used the compile_time_config example to test it.

@bconn98
Copy link
Collaborator

bconn98 commented Jun 7, 2024

@EvilWatermelon Please close this if you're all set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants