MCPcopy
hub / github.com/volcengine/MineContext / createBackendLogFile

Function createBackendLogFile

frontend/src/main/backend.ts:152–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150
151// Create backend log file
152function createBackendLogFile() {
153 const debugLogDir = path.join(app.getPath('userData'), 'debug')
154 if (!fs.existsSync(debugLogDir)) {
155 fs.mkdirSync(debugLogDir, { recursive: true })
156 }
157
158 const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
159 const logFileName = `backend-${timestamp}.log`
160 const logFilePath = path.join(debugLogDir, logFileName)
161
162 // Create the log file with initial headers
163 const initialLog = `=== VIKINGDB Backend Debug Log ===
164Started: ${new Date().toISOString()}
165Platform: ${process.platform}
166Architecture: ${process.arch}
167Node version: ${process.version}
168Electron version: ${process.versions.electron}
169Process execPath: ${process.execPath}
170Process cwd: ${process.cwd()}
171__dirname: ${__dirname}
172Resources path: ${process.resourcesPath}
173Is packaged: ${isPackaged}
174Actually dev: ${actuallyDev}
175========================================
176
177`
178
179 fs.writeFileSync(logFilePath, initialLog)
180 safeLog.log(`Created backend log file: ${logFilePath}`)
181
182 return logFilePath
183}
184
185// Helper function to log to backend log file
186export function logToBackendFile(message) {

Callers 1

logToBackendFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected