feat: add daily logging and improve workspace UI and ROS status
This commit is contained in:
+5
-13
@@ -1,4 +1,5 @@
|
||||
import { app, BrowserWindow, dialog, Menu, globalShortcut, ipcMain, screen, shell } from 'electron'
|
||||
import { appLog } from './appLogging'
|
||||
import { checkDockerStatus } from './dockerStatus'
|
||||
import { cameraRuntimeArtifacts } from './cameraRuntime'
|
||||
import { remoteModuleFilesScript } from './remoteModuleFiles'
|
||||
@@ -12,7 +13,7 @@ import type { WebContents } from 'electron'
|
||||
import { spawn } from 'child_process'
|
||||
import * as pty from 'node-pty'
|
||||
import type { IPty } from 'node-pty'
|
||||
import { appendFileSync, createReadStream, createWriteStream, existsSync, mkdirSync } from 'fs'
|
||||
import { createReadStream, createWriteStream, existsSync } from 'fs'
|
||||
import { cp, mkdir, readdir, readFile, rename, rm, stat, writeFile } from 'fs/promises'
|
||||
import { homedir } from 'os'
|
||||
import { basename, dirname, join, relative, resolve } from 'path'
|
||||
@@ -51,21 +52,12 @@ const rosBridgePort = 8765
|
||||
const exampleCodeRoot = resolve(homedir(), '다운로드', 'example-code')
|
||||
|
||||
function writeRendererDiagnostic(kind: string, message: string): void {
|
||||
try {
|
||||
const logDirectory = app.getPath('logs')
|
||||
mkdirSync(logDirectory, { recursive: true })
|
||||
appendFileSync(
|
||||
join(logDirectory, 'renderer.log'),
|
||||
`[${new Date().toISOString()}] [${kind}] ${message}\n`,
|
||||
'utf8',
|
||||
)
|
||||
} catch {
|
||||
// Diagnostics must never interrupt the LMS window itself.
|
||||
}
|
||||
appLog.write(kind, message)
|
||||
}
|
||||
|
||||
async function readAppDiagnostics(): Promise<{ path: string; content: string }> {
|
||||
const logPath = join(app.getPath('logs'), 'renderer.log')
|
||||
const logPath = appLog.path()
|
||||
if (!logPath) return { path: '', content: '' }
|
||||
|
||||
try {
|
||||
const content = await readFile(logPath, 'utf8')
|
||||
|
||||
Reference in New Issue
Block a user