Logging

The Relision library supports logging using the log crate, configured via environment variables using the env_logger crate.

Enabling Logging

Logging is enabled using the RELISION_LOG environment variable. You may specify a logging level for the entire library as follows: RELISION_LOG=debug. This will display debugging information for the entire library, and also for any other libraries that use the log crate. As such, you might want to reduce the scope. To see logging information for only Relision, use RELISION_LOG=relision=debug.

You can reduce the scope even further by including multiple specifiers, separated with commas, as: RELISION_LOG=relision=info,relision::repl=debug.

Using Logging

To use logging from within the library, simply use the macros provided by the log crate.

  1. use log::{debug,info};
  2. //...
  3. info!("The number is {}", number);

You can specify a target for the log message as follows: info!(target: “lifecycle”, “Shutting down”);, and then select that target.

If you are writing an executable that will use the library, you should enable logging by calling relision::configure_logging(); at the start of your executable.