MCPcopy
hub / github.com/mobile-next/mobile-mcp / writeLog

Function writeLog

src/logger.ts:3–13  ·  view source on GitHub ↗
(message: string)

Source from the content-addressed store, hash-verified

1import { appendFileSync } from "node:fs";
2
3const writeLog = (message: string) => {
4 if (process.env.LOG_FILE) {
5 const logfile = process.env.LOG_FILE;
6 const timestamp = new Date().toISOString();
7 const levelStr = "INFO";
8 const logMessage = `[${timestamp}] ${levelStr} ${message}`;
9 appendFileSync(logfile, logMessage + "\n");
10 }
11
12 console.error(message);
13};
14
15export const trace = (message: string) => {
16 writeLog(message);

Callers 2

traceFunction · 0.85
errorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected