pub struct LogBuilder { /* private fields */ }Implementations§
Source§impl LogBuilder
impl LogBuilder
Sourcepub fn new(default_logging_targets: Vec<(String, Level)>) -> Self
pub fn new(default_logging_targets: Vec<(String, Level)>) -> Self
Create a new builder
Provide the default_logging_targets that are used if the ANT_LOG env variable is not set.
By default, we use log to the StdOut with the default format.
Sourcepub fn output_dest(&mut self, output_dest: LogOutputDest)
pub fn output_dest(&mut self, output_dest: LogOutputDest)
Set the logging output destination
Sourcepub fn max_log_files(&mut self, files: usize)
pub fn max_log_files(&mut self, files: usize)
The max number of uncompressed log files to store
Sourcepub fn max_archived_log_files(&mut self, files: usize)
pub fn max_archived_log_files(&mut self, files: usize)
The max number of compressed files to store
Sourcepub fn print_updates_to_stdout(&mut self, print: bool)
pub fn print_updates_to_stdout(&mut self, print: bool)
Setting this to false would prevent ant_logging from printing things to stdout.
Sourcepub fn initialize(self) -> Result<(ReloadHandle, Option<WorkerGuard>), Error>
pub fn initialize(self) -> Result<(ReloadHandle, Option<WorkerGuard>), Error>
Inits node logging, returning the NonBlocking guard if present. This guard should be held for the life of the program.
Logging should be instantiated only once.
Sourcepub fn init_single_threaded_tokio_test(
test_file_name: &str,
disable_networking_logs: bool,
) -> (Option<WorkerGuard>, DefaultGuard)
pub fn init_single_threaded_tokio_test( test_file_name: &str, disable_networking_logs: bool, ) -> (Option<WorkerGuard>, DefaultGuard)
Logs to the data_dir. Should be called from a single threaded tokio/non-tokio context. Provide the test file name to capture tracings from the test.
subscriber.set_default() should be used if under a single threaded tokio / single threaded non-tokio context. Refer here for more details: https://github.com/tokio-rs/tracing/discussions/1626
Sourcepub fn init_multi_threaded_tokio_test(
test_file_name: &str,
disable_networking_logs: bool,
) -> Option<WorkerGuard>
pub fn init_multi_threaded_tokio_test( test_file_name: &str, disable_networking_logs: bool, ) -> Option<WorkerGuard>
Logs to the data_dir. Should be called from a multi threaded tokio context. Provide the test file name to capture tracings from the test.
subscriber.init() should be used under multi threaded tokio context. If you have 1+ multithreaded tokio tests under the same integration test, this might result in loss of logs. Hence use .init() (instead of .try_init()) to panic if called more than once.