Expand description
Module for logging in Internet Computer canisters.
This module provides a logging system for canisters that supports both regular logs
and traces, with JSON formatting and circular buffer storage. It integrates with
the tracing ecosystem for structured logging.
§Example
use bity_ic_canister_logger::{init, export_logs};
use tracing::info;
// Initialize the logger
init(true); // Enable tracing
// Log some messages
info!("Application started");
tracing::trace!("Detailed trace message");
// Export logs
let logs = export_logs();Structs§
- LogBuffer
- A circular buffer for storing log messages.
- LogEntry
- Represents a single log entry with timestamp and message.
Functions§
- export_
logs - Exports all current log entries.
- export_
traces - Exports all current trace entries.
- init
- Initializes the logging system.
- init_
with_ logs - Initializes the logging system with pre-existing logs.