Drakulix / simplelog.rs

Simple Logging Facility for Rust
https://docs.rs/simplelog/
Apache License 2.0
423 stars 71 forks source link

paris feature not working #91

Closed TheBotlyNoob closed 2 years ago

TheBotlyNoob commented 2 years ago

not sure if i'm doing something wrong, but when I try:

# Cargo.toml
[package]
name = "test"
version = "0.1.0"
edition = "2021"

[dependencies]
simplelog = { version = "0.11", features = ["paris"] }
use log::info;

fn main() {
  simplelog::CombinedLogger::init(vec![
    simplelog::TermLogger::new(
      simplelog::LevelFilter::Debug,
      simplelog::Config::default(),
      simplelog::TerminalMode::Mixed,
      simplelog::ColorChoice::Auto,
    ),
    simplelog::WriteLogger::new(
      simplelog::LevelFilter::Debug,
      simplelog::Config::default(),
      std::fs::File::create("my_rust_binary.log").unwrap(),
    ),
  ])
  .expect("Failed to start simplelog");

  info!("I can write <b>bold</b> text or use tags to <red>color it</>");
}

it outputs: 02:33:51 [INFO] I can write <b>bold</b> text or use tags to <red>color it</>

manio commented 2 years ago

Hi @TheBotlyNoob I tested your code and ... it works for me :) I just created a new project with cargo init test, then I've put your contents. I only added a log crate line to dependencies as it was complaining about lack of info! macro so I had this:

[dependencies]
simplelog = { version = "0.11", features = ["paris"] }
log = "0.4.1"

Then I also added at the beginning of your main this:

extern crate simplelog;
use simplelog::*;

And it works perfectly fine with colors...

manio commented 2 years ago

@TheBotlyNoob Did you managed to get it work?

TheBotlyNoob commented 2 years ago

I was using log's info! instead of simplelog's info!

(Sorry for the late reply, I'm horrible at responding to issues)