| Crates.io | alembic-log |
| lib.rs | alembic-log |
| version | 0.1.3 |
| created_at | 2025-08-07 01:38:28.997161+00 |
| updated_at | 2025-09-14 17:20:48.011139+00 |
| description | A Rust crate that lets you log once, send anywhere. |
| homepage | https://github.com/mnowzari/alembic |
| repository | https://github.com/mnowzari/alembic |
| max_upload_size | |
| id | 1784587 |
| size | 35,321 |
Send the same log message to stdout, stderr and a log file at the same time, with a single function call!
Currently supported output sinks:
stdoutstderrhourly, daily, weekly and monthly)To-do
stdout and File sink simultaneously// Create a log handler. Default log level is Error.
let mut logger: Handler = Handler::new().unwrap();
// Create stdout and file sink instances
let mut stdout_sink: StdoutSink = Stdout::new().unwrap();
let mut file_sink: FileSink = FileSink::new(
PathBuf::from("./my_application.log"),
alembic::filesink::RotationPolicy::Weekly
).unwrap();
// Add the sinks to the log handler
logger.add_sink(Box::new(stdout_sink));
logger.add_sink(Box::new(file_sink));
// Write some logs!
logger.info("Hello, Alembic!")
logger.error("Oh dear, there's been a terrible error.")
Log formats are currently non-adjustable. Here is an example log line that is generated by Alembic:
[2025-08-03T14:51:54.936003992-04:00] [DEBUG] [file] There is a bug!
[2025-08-03T14:51:54.936172325-04:00] [INFO] [file] Wow, so informational.
[2025-08-03T14:51:54.936190558-04:00] [WARN] [file] WARNING
[2025-08-03T14:51:54.936206347-04:00] [ERROR] [file] ! ERROR !
[2025-08-03T14:51:54.936221734-04:00] [FATAL] [file] FATALITY.
The project is buildable directly via
cargo build
However, we also have a Makefile to make common development actions easier.
make build # development build
make build-release # release build
The Makefile has several other functions defined as well - check the file for a complete accounting of commands.