Expand description

simple-log is a very simple configuration log crates.

simple-log format output

2020-12-07 15:06:03.260570000 [INFO] <json_log:16>:info json simple_log
2020-12-07 15:06:03.262106000 [WARN] <json_log:17>:warn json simple_log
2020-12-07 15:06:03.262174000 [ERROR] <json_log:18>:error json simple_log

Quick Start

To get you started quickly, the easiest and quick way to used with demo or test project

extern crate simple_log;

fn main() {

   debug!("test quick debug");
   info!("test quick info");

Usage in project

Configuration LogConfig in your project.

extern crate simple_log;

use simple_log::LogConfigBuilder;

fn main() -> Result<(), String> {
   let config = LogConfigBuilder::builder()
       .size(1 * 100)

   debug!("test builder debug");
   info!("test builder info");

Config with json

extern crate simple_log;

use simple_log::LogConfig;

fn main() {
    let config = r#"
    let log_config: LogConfig = serde_json::from_str(config).unwrap();

    simple_log::new(log_config).unwrap();//init log

    info!("info json simple_log");
    warn!("warn json simple_log");
    error!("error json simple_log");

For the user guide and futher documentation, please read The simple-log document.

More than examples can see: examples.


pub extern crate log;




The LogConfig with builder wrapper.


Provide init simple-log instance with stdout console on terminal.

Provide init simple-log instance with write file.

Get simple-log global config LogConfig

The new method provide init simple-log instance with config.

This method can quick init simple-log with no configuration.

Update simple-log global config LogConfig.

update simple-log global config log level.

Type Definitions