MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / log

Method log

src/agent/task_logger.rs:45–64  ·  view source on GitHub ↗

JSON-serializes `log_line` to the file. Prints to stdout/stderr when `!suppress_stdout`.

(&self, log_line: LogLine)

Source from the content-addressed store, hash-verified

43
44 /// JSON-serializes `log_line` to the file. Prints to stdout/stderr when `!suppress_stdout`.
45 pub fn log(&self, log_line: LogLine) {
46 if let Ok(mut guard) = self.file.lock()
47 && let Some(f) = guard.as_mut()
48 && let Ok(json) = serde_json::to_string(&log_line)
49 {
50 let _ = writeln!(f, "{json}");
51 }
52
53 if !self.suppress_stdout {
54 match &log_line {
55 LogLine::Message {
56 level: Level::Warning | Level::Error,
57 message,
58 ..
59 } => eprintln!("{message}"),
60 LogLine::Message { message, .. } => println!("{message}"),
61 _ => {}
62 }
63 }
64 }
65
66 fn open_append(path: &Path) -> Option<File> {
67 if let Some(parent) = path.parent() {

Callers 11

run_in_containerMethod · 0.80
acquire_build_lockMethod · 0.80
ensure_imageMethod · 0.80
build_docker_imageMethod · 0.80
build_proxyMethod · 0.80
acquire_proxyMethod · 0.80
wait_for_proxy_healthMethod · 0.80
test_log_writes_to_fileFunction · 0.80
index.jsFile · 0.80

Calls

no outgoing calls

Tested by 3

test_log_writes_to_fileFunction · 0.64