Skip to content

Commit

Permalink
Print mod name in disk logs
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbl committed Jun 22, 2024
1 parent 5689728 commit 1c13ce6
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/main/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1163,15 +1163,12 @@ export async function initBridgeAPI(mainWindow: BrowserWindow): Promise<void> {
const consoleMethods = ['debug', 'log', 'warn', 'error'] as const;
consoleMethods.forEach((level: (typeof consoleMethods)[number]) => {
consoleWrapper[level] = (...args) => {
nativeConsole[level](...args);
if (runtime?.isModInstalling() ?? false) {
mainWindow.webContents.send('console', [
level,
[`[${runtime!.mod!.info.name}]`, ...args],
]);
} else {
mainWindow.webContents.send('console', [level, args]);
}
const newArgs =
runtime?.isModInstalling() ?? false
? [`[${runtime!.mod!.info.name}]`, ...args]
: args;
nativeConsole[level](...newArgs);
mainWindow.webContents.send('console', [level, newArgs]);
};
});
Object.assign(console, consoleWrapper);
Expand Down

0 comments on commit 1c13ce6

Please sign in to comment.