MCPcopy Create free account
hub / github.com/AS-AIGC/TranscriptHub / logger

Function logger

apps/backend/logger.js:44–59  ·  view source on GitHub ↗
(level, message, data = {})

Source from the content-addressed store, hash-verified

42
43
44async function logger(level, message, data = {}) {
45 /* Generate UTC+8 timestamp */
46 const timestamp = generate_timestamp();
47
48 /* Formmatted message */
49 const log_entry = formatted_message(timestamp, level, message);
50
51 /* Handle output */
52 // write_to_console(log_entry);
53 write_to_log_file(log_entry);
54
55 /* Write to database if metadata provided */
56 if (has_metadata(data)) {
57 await write_to_database(level, message, data);
58 }
59}
60
61function generate_timestamp() {
62 const UTC8_OFFSET = 0; // Correct UTC+8 offset

Callers 15

main.jsFile · 0.85
execute_taskFunction · 0.85
is_media_file_callbackFunction · 0.85
send_notificationFunction · 0.85
log_successful_responseFunction · 0.85
log_failed_responseFunction · 0.85
cancel_task_controllerFunction · 0.85

Calls 5

generate_timestampFunction · 0.85
formatted_messageFunction · 0.85
write_to_log_fileFunction · 0.85
has_metadataFunction · 0.85
write_to_databaseFunction · 0.85

Tested by

no test coverage detected