mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-28 17:01:04 +00:00
a0b3968d33
Reorganize the panel around product capabilities and integrate the remote i18n feature from origin/master into the new structure. - Restructure src into capability features (app, trainer, library, remote-session, appearance, shared); move the bridge to bridge/src. - Add lingui-based UI localization and wrap remaining user-facing strings (Trans / msg macros); fix the 'END В·' mojibake. - Port WeMod cheat-metadata i18n: capture the access token from the snapshot's renderer in the bridge and fetch localized trainer_meta in remote-session.i18n; guarantee snapshot sync on token failure. - Wire vitest to the app's lingui/preact pipeline (mergeConfig).
37 lines
1.1 KiB
TypeScript
Vendored
37 lines
1.1 KiB
TypeScript
Vendored
const fs = require('node:fs');
|
|
const os = require('node:os');
|
|
const path = require('node:path');
|
|
|
|
const { BRIDGE_LOG_FILE_NAME } = require('./constants');
|
|
import type { BridgeOptions } from './types';
|
|
|
|
function writeLogLine(logFile, level, message, error) {
|
|
const method = level === 'error' ? 'error' : level === 'warn' ? 'warn' : 'info';
|
|
const tag = `[wand-remote-bridge] ${message}`;
|
|
|
|
try {
|
|
console[method](tag, error || '');
|
|
} catch { }
|
|
|
|
try {
|
|
const detail = error ? ` :: ${error && error.stack ? error.stack : String(error)}` : '';
|
|
fs.appendFileSync(logFile, `[${new Date().toISOString()}] [${level}] ${message}${detail}\n`);
|
|
} catch { }
|
|
}
|
|
|
|
function createBridgeLogger(options: BridgeOptions = {}) {
|
|
const logFile = options.logFile || path.join(os.tmpdir(), BRIDGE_LOG_FILE_NAME);
|
|
const log = (level, message, error) => writeLogLine(logFile, level, message, error);
|
|
log.file = logFile;
|
|
return log;
|
|
}
|
|
|
|
function writeInstallLog(level, message, error) {
|
|
writeLogLine(path.join(os.tmpdir(), BRIDGE_LOG_FILE_NAME), level, message, error);
|
|
}
|
|
|
|
module.exports = {
|
|
createBridgeLogger,
|
|
writeInstallLog,
|
|
};
|