MCPcopy Index your code
hub / github.com/jetify-com/devbox / logToFile

Function logToFile

vscode-extension/src/devbox.ts:148–163  ·  view source on GitHub ↗
(dotDevboxPath: Uri, message: string)

Source from the content-addressed store, hash-verified

146}
147
148async function logToFile(dotDevboxPath: Uri, message: string) {
149 // only print to log file if debug mode config is set to true
150 if (workspace.getConfiguration("devbox").get("enableDebugMode")){
151 try {
152 const logFilePath = Uri.joinPath(dotDevboxPath, 'extension.log');
153 const timestamp = new Date().toUTCString();
154 const fileHandler = await open(logFilePath.fsPath, 'a');
155 const logData = new Uint8Array(Buffer.from(`[${timestamp}] ${message}\n`));
156 await writeFile(fileHandler, logData, {flag: 'a'} );
157 await fileHandler.close();
158 } catch (error) {
159 console.log("failed to write to extension.log file");
160 console.error(error);
161 }
162 }
163}

Callers 1

devboxReopenFunction · 0.85

Calls 2

openFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected