Skip to content

Trivial: the systemd example misuses RUST_LOG_STYLE #286

Open

Description

@iustin

I might be wrong, but the systemd example (added in #157) overloads RUST_LOG_STYLE. Since that is parsed internally by env_logger, I think the example is suboptimal; it would be better to control the systemd-vs-non-systemd and style separately, as long as systemd is not directly supported (which would be best, actually, as a new WriteStyle).

I might misunderstand the way the WriteStyle is supposed to work though, not sure.

Activity

  1. Gunni commented on Jan 12, 2024

    @Gunni

    Also, the example given has this error in it

    error[E0599]: cannot write into `&mut env_logger::fmt::Formatter`
      --> src/main.rs:26:5
       |
    25 | /             writeln!(
    26 | |                 buf,
       | |                 ^^^
    27 | |                 "<{}>{}: {}",
    28 | |                 match record.level() {
    ...  |
    36 | |                 record.args()
    37 | |             )
       | |_____________- method not found in `&mut Formatter`
       |
    note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method
      --> src/main.rs:26:5
       |
    26 |                 buf,
       |                 ^^^
       = help: items from traits can only be used if the trait is in scope
    help: the following trait is implemented but not in scope; perhaps add a `use` for it:
       |
    1  + use std::io::Write;
       |
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions