logcat 0.0.1

A simple and lightweight logging library.
Documentation
  • Coverage
  • 0%
    0 out of 11 items documented0 out of 8 items with examples
  • Size
  • Source code size: 13.97 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.32 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • dev-mp4/logcat
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tspstudio

Logcat - a simple, lightweight logging library

Logcat is simple logging library written in Rust

Usage

use logcat::logger::Logger;
fn main() {
	// Creating logging class
	let mut logger = Logger::new(String::from("output/log/filename.txt"));
	// Logging
	logger.info(String::from("This is info!"));
	logger.warning(String::from("This is warning!"));
	logger.error(String::from("This is error!"));
	logger.custom(String::from("CUSTOM"), String::from("This is custom log!"));
	logger.export(); // Will export all logs with timestamp.
	logger.critical(String::from("This is critical error! Program will export logs and exit with code -1!"));
}

Output:

[INFO] 14:42:29 >> This is info!
[WARNING] 14:42:29 >> This is warning!
[ERROR] 14:42:29 >> This is error!
[CUSTOM] 14:42:29 >> This is custom log!
[INFO] 14:42:29 >> Log exported successfully!
[CRITICAL ERROR] 14:42:29 >> This is critical error! Program will exit with code -1!
[INFO] 14:42:29 >> Log exported successfully!

Log file:

# Log generated by Logcat v0.0.1
# Exported at 14:42:29

[INFO] 14:42:29 >> This is info!
[WARNING] 14:42:29 >> This is warning!
[ERROR] 14:42:29 >> This is error!
[CUSTOM] 14:42:29 >> This is custom log!
[INFO] 14:42:29 >> Log exported successfully!
[CRITICAL ERROR] 14:42:29 >> This is critical error! Program will exit with code -1!

GitHub