ez_log

Crates.ioez_log
lib.rsez_log
version0.1.4
sourcesrc
created_at2024-09-08 12:58:01.413617
updated_at2024-09-21 17:50:34.559746
descriptionSimple logging library for Rust
homepage
repositoryhttps://github.com/JajaNooba/ez-log
max_upload_size
id1368073
size9,429
(JajaNooba)

documentation

https://docs.rs/ez_log/latest/ez_log/

README

ez_log: Simple logging library for Rust

Features

Ez_log can be configured using Rust features.

Default features:

  • color: Colored terminal output.
  • time: Adds time for every log output. Time format can be configured by editing EZ_LOG_TIME_FORMAT env variable, using chrono format syntax.

Optional features:

  • dump: Creates file for every day and writes to it log output. Directory for those files can be configured by editing EZ_LOG_LOGS_DIR env variable.

Overview

Logs are perform by log_info!, log_warn! and log_error! macros. Usage of those macros is similar to print_ln! macro.

Example

use ez_log::*;

let address = "127.0.0.1";
let port = 8000;

match start_web_server() {
    Ok() => {
        log_info!("Server started on {}:{}", address, port);
        // continue execution
    },
    Err(error) => {
        log_error!("Error while starting web server! {}", error);
        // exit program 
    }
}
use ez_log::*;

if let Err(error) = handle_request() {
    log_warn!("Could not respond to request! {}", error);
}
Commit count: 10

cargo fmt