(dotDevboxPath: Uri, message: string)
| 146 | } |
| 147 | |
| 148 | async 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 | } |
no test coverage detected