Skip to main content

init_logging

Function init_logging 

Source
pub fn init_logging() -> MemScopeResult<()>
Expand description

Initialize logging system for memscope-rs.

This function sets up the tracing subscriber with appropriate filtering and formatting for memory tracking operations.

§Example

use memscope_rs::init_logging;

init_logging();
// Now logging is configured and ready to use

§Environment Variables

The logging level can be controlled via the RUST_LOG environment variable:

  • RUST_LOG=memscope_rs=error - Only errors
  • RUST_LOG=memscope_rs=warn - Warnings and errors
  • RUST_LOG=memscope_rs=info - Info, warnings, and errors (default)
  • RUST_LOG=memscope_rs=debug - Debug, info, warnings, and errors

§Errors

Returns an error if the log filter directive cannot be parsed.

§Note

This function can be called multiple times safely; subsequent calls will be ignored.