logsy

Crates.iologsy
lib.rslogsy
version1.0.1
created_at2025-05-31 08:11:22.249385+00
updated_at2025-05-31 16:47:02.914885+00
descriptionJust logging as it should be
homepage
repositoryhttps://github.com/vdudouyt/logsy
max_upload_size
id1696168
size22,542
Valentin Dudouyt (vdudouyt)

documentation

https://docs.rs/logsy/

README

Logsy

Just logging as it should be. While it barely exceeds 100 lines of source code, it covers almost any practical case you could ever encounter.

Common concepts

  • Use logsy::set_echo() to start logging into stdout
  • Use logsy::set_filename() to start logging into a specified file. If parent dir doesn't exists, it's going to be created
  • Use logsy::set_level() to alter logging level (defaults to LevelFilter::Info)
  • You can combine logsy::set_echo() and logsy::set_filename() in the same application
  • You can alter the settings by calling logsy::set_echo() or logsy::set_filename() again at any time
  • Rather being a standalone package, it's simply a backend for the famous log crate

Example

use log::*;

fn main() {
    logsy::set_echo(true);
    logsy::set_filename(Some("logs/main.log")).expect("Couldn't open main.log");

    info!("Application has just started");
    warn!("Dereferencing null pointers harms");
    error!("This application got a boo-boo and going to be terminated");
}
Commit count: 6

cargo fmt