Added ipc call to copy log file (ipcRenderer.send('fetch-log'))
This commit is contained in:
parent
0efd4eb643
commit
1546bc3ea7
1 changed files with 7 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
import {app, Menu, nativeImage, Tray} from 'electron';
|
||||
import {app, Menu, nativeImage, Tray, ipcMain, clipboard} from 'electron';
|
||||
import {readFileSync} from "fs";
|
||||
import * as path from 'path';
|
||||
import * as log from 'electron-log';
|
||||
import {utils} from './utils';
|
||||
|
@ -294,5 +295,10 @@ export class AppEvents {
|
|||
private static initLogging() {
|
||||
log.transports.console.format = '[{h}:{i}:{s}.{ms}] [{level}] {text}';
|
||||
Object.assign(console, log.functions);
|
||||
|
||||
ipcMain.on('fetch-log', (_event) => {
|
||||
const data = readFileSync(log.transports.file.getFile().path, {encoding: 'utf8', flag: 'r'});
|
||||
clipboard.writeText(data)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue