| Crates.io | tincre-logger |
| lib.rs | tincre-logger |
| version | 0.1.2 |
| created_at | 2025-07-18 20:42:47.043438+00 |
| updated_at | 2025-07-20 22:57:53.784262+00 |
| description | A simple, 'zero-setup' logging library for Rust that works out-of-the-box with a familiar API. Powered by tracing. |
| homepage | https://github.com/Tincre/tincre-logger |
| repository | https://github.com/Tincre/tincre-logger |
| max_upload_size | |
| id | 1759662 |
| size | 33,658 |
tincre-logger is a simple, "zero-setup" logging library for Rust that works out-of-the-box with a familiar API.
It's designed to be efficient and easy to use, providing automatic initialization on the first log call.
Here are the logging functions included in this library:
log() / info() for informational messages.warn() for warnings.error() for errors.debug() for verbose debugging messages.info_with(), warn_with(), error_with(), and debug_with() for structured logs with JSON metadata.This library leverages tracing to provide structured, high-performance logging with minimal boilerplate.
init() function is required in your application's main.log(), info(), warn(), error(), and debug() functions in a flat logger module._with() variants to attach JSON-serializable metadata to any log message.RUST_LOG environment variable to control log levels (e.g., RUST_LOG=debug).Add tincre-logger to your Cargo.toml:
cargo add tincre-logger
use tincre_logger::logger;
use serde_json::json;
fn main() {
logger::info("Application starting up.");
logger::warn("Configuration file not found, using defaults.");
let user_id = "abc-123";
logger::debug(&format!("Processing data for user: {}", user_id));
logger::error("Failed to connect to the database!");
// Structured logging examples
logger::info_with("User signed in", json!({ "user_id": user_id }));
logger::warn_with("Cache miss", json!({ "key": "user_profile", "attempts": 2 }));
logger::error_with("Write failed", json!({ "error": "disk full", "code": 507 }));
logger::debug_with("Loading config", json!({ "env": "staging", "source": "fallback" }));
}
To see the debug-level logs, run your application with the RUST_LOG environment variable:
RUST_LOG=debug cargo run
This project is licensed under the MIT License.