alembic-log 0.1.2

A Rust crate that lets you log once, send anywhere.
Documentation
  • Coverage
  • 2.56%
    1 out of 39 items documented0 out of 20 items with examples
  • Size
  • Source code size: 33.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.6 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 20s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • mnowzari/alembic
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mnowzari

Alembic

Log once, send anywhere.

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:

  • stdout
  • stderr
  • Log file
    • Rotation policies (hourly, daily, weekly and monthly)

To-do

  • Elasticsearch sink
  • Adjustable log formats

Example: Write to a stdout and File sink simultaneously

// Create a log handler
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.")

The log line format

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.

Building from source

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.