Files
Wand-Enhancer/web-panel/bridge/scripts/default/installed-apps-sync/logger.js
T
kitbyte 13759b1db6 feat: ship 1.0.8.0 release automation and runtime overhaul
- reduce ASAR IO overhead with streamed archive reads, buffered copies, faster relative-path handling and placeholder integrity records
- fix in-place app.asar.unpacked packing/extraction self-copy cases that caused locked-file failures
- tighten JS patch discovery with candidate bundle filters and search hints
- require prebuilt remote-panel dist artifacts and clean up embedded bridge/script packaging
- add unified build entrypoints for PowerShell, cmd and bash and move native CMake output under .tmp
- add release metadata validation, changelog section extraction, pre-commit hook and GitHub Actions validation/release pipelines
- make CHANGELOG the source of truth for release notes and document the tag-driven release flow
- add updater release notes UI with latest/full changelog loading and localize the new update strings
- modularize bridge renderer scripts, add installed apps and game status sync, and support remote launch/stop commands
- centralize bridge protocol, IPC and WebSocket constants and improve LAN IP selection for QR pairing
- refactor remote panel controls/state enums, persist accent color, polish library/session UI and refresh assets
2026-05-06 13:07:09 +03:00

47 lines
1.2 KiB
JavaScript

import { LOG_FILE_NAME, LOG_PREFIX } from "./constants.js"
import { getRequire } from "./runtime.js"
export function createLogger(WandEnhancer) {
let filePath = null
try {
const require = getRequire()
const os = require?.("node:os")
const path = require?.("node:path")
if (os && path) {
filePath = path.join(os.tmpdir(), LOG_FILE_NAME)
globalThis.__wandInstalledAppsSyncLogFile = filePath
}
} catch (error) {}
return function log(level, message, detail) {
const method =
level === "error" ? "error" : level === "warn" ? "warn" : "info"
const line = `[${new Date().toISOString()}] [${level}] ${message}${detail ? ` :: ${detail}` : ""}`
try {
console[method](LOG_PREFIX, message, detail || "")
} catch (error) {}
try {
if (WandEnhancer?.log) {
WandEnhancer.log(`${LOG_PREFIX} ${message}`, detail || "")
}
} catch (error) {}
writeFile(filePath, line)
}
}
function writeFile(filePath, line) {
if (!filePath) {
return
}
try {
const require = getRequire()
const fs = require?.("node:fs")
fs?.appendFileSync(filePath, `${line}\n`)
} catch (error) {}
}