ecs-logger
A Rust logger compatible with Elastic Common Schema (ECS) Logging.
Features
- Configurable via the RUST_LOG environment variable.
- Uses env_logger under the hood.
- By default, all logging is disabled except for the error level.
- By default logs are written to stderr.
Example
In the following examples we assume the binary is ./example
.
Basic logging
use ;
init;
debug!;
error!;
} }}}
} }}}
} }}}
More filtering config examples are available at env_logger’s documentation.
Write to stdout
use info;
// Initialize custom logger
builder
.format // Configure ECS logger
.target // Write to stdout
.init;
info!;
Configure log filters
use info;
// Initialize custom logger
builder
.parse_filters // Set filters
.format // Configure ECS logger
.init;
info!;
Log fields
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Acknowledgments
The implementation of this software is based on env_logger, which is dual licenced as well.