Replace console logger with a basic Clogger implementation; remove log dependency and increment version to 0.1.2
cargo build / build (push) Successful in 6s
cargo test / test (push) Successful in 3s
cargo test / publish (push) Successful in 3s

This commit is contained in:
2026-08-22 13:36:02 -05:00
parent 1dea6c479d
commit d8253fcc30
3 changed files with 8 additions and 41 deletions
+6 -28
View File
@@ -1,30 +1,8 @@
// src/lib.rs
//! Console logging utilities for Rust applications.
use log::{Level, LevelFilter, Metadata, Record, SetLoggerError};
/// A minimal console logger implementation.
pub struct ConsoleLogger;
static LOGGER: ConsoleLogger = ConsoleLogger;
impl log::Log for ConsoleLogger {
fn enabled(&self, metadata: &Metadata<'_>) -> bool {
metadata.level() <= Level::Info
}
fn log(&self, record: &Record<'_>) {
if self.enabled(record.metadata()) {
println!("[{}] {}", record.level(), record.args());
}
}
fn flush(&self) {}
struct Clogger{
}
/// Initializes the console logger with `Info` as the maximum log level.
pub fn init() -> Result<(), SetLoggerError> {
log::set_logger(&LOGGER)?;
log::set_max_level(LevelFilter::Info);
Ok(())
impl Clogger{
pub fn output(){
println!("Hello, world!");
}
}