MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / init

Function init

atomic-cli/src/logging/mod.rs:86–113  ·  view source on GitHub ↗

Install logging for this process. Call once, before anything logs.

()

Source from the content-addressed store, hash-verified

84
85/// Install logging for this process. Call once, before anything logs.
86pub(crate) fn init() {
87 let mut layers = vec![terminal_layer()];
88 let mut unusable = None;
89 let mut opened = None;
90 if let Some((directives, dir)) = file_settings() {
91 match open_file(dir.path()) {
92 Ok(appender) => {
93 layers.push(file_layer(appender, &directives));
94 opened = Some(dir);
95 }
96 Err(error) => unusable = Some((dir, error)),
97 }
98 }
99 if tracing_subscriber::registry()
100 .with(layers)
101 .try_init()
102 .is_err()
103 {
104 return;
105 }
106 log_panics();
107 if let Some((dir, error)) = unusable {
108 report_unusable(&dir, &error);
109 }
110 if let Some(dir) = opened {
111 prune_old_files(dir.path());
112 }
113}
114
115/// A command's run in the log: every line inside it carries
116/// `atomic{cmd=git import}`, and its start and end are logged.

Calls 9

file_settingsFunction · 0.85
open_fileFunction · 0.85
file_layerFunction · 0.85
registryFunction · 0.85
log_panicsFunction · 0.85
report_unusableFunction · 0.85
prune_old_filesFunction · 0.85
pathMethod · 0.45
pushMethod · 0.45