Logging

OpenDAL has native support for logging.

Logging Layer

LoggingLayer will print logs for every operation with the following rules:

  • OpenDAL will log in structural way.
  • Every operation will start with a started log entry.
  • Every operation will finish with the following status:
    • finished: the operation is successful.
    • errored: the operation returns an expected error like NotFound.
    • failed: the operation returns an unexpected error.

Enable logging layer is easy:

use anyhow::Result;
use opendal::layers::LoggingLayer;
use opendal::Operator;
use opendal::Scheme;

let _ = Operator::from_env(Scheme::Fs)
    .expect("must init")
    .layer(LoggingLayer);

Logging Output

OpenDAL is using log for logging internally.

To enable logging output, please set RUST_LOG:

RUST_LOG=debug ./app

To config logging output, please refer to Configure Logging:

RUST_LOG="info,opendal::services=debug" ./app