Drakulix/simplelog.rs

paris feature not working

TheBotlyNoob opened this issue · 3 comments

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

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

@TheBotlyNoob
Did you managed to get it work?

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

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