# 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
## Example: Write to a `stdout` and `File` sink simultaneously
```rust
// 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.")
```
### The log line format
Log formats are currently non-adjustable. Here is an example log line that is generated by Alembic:
```log
[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
```shell
cargo build
```
However, we also have a `Makefile` to make common development actions easier.
```shell
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.