mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 08:33:58 +00:00
configuring logger for electron
This commit is contained in:
@@ -333,6 +333,7 @@ function createWindow() {
|
|||||||
// path.join(__dirname, process.env.DEVMODE ? '../../packages/api/src/index' : '../packages/api/dist/bundle.js')
|
// path.join(__dirname, process.env.DEVMODE ? '../../packages/api/src/index' : '../packages/api/dist/bundle.js')
|
||||||
// )
|
// )
|
||||||
// );
|
// );
|
||||||
|
api.configureLogger();
|
||||||
const main = api.getMainModule();
|
const main = api.getMainModule();
|
||||||
main.useAllControllers(null, electron);
|
main.useAllControllers(null, electron);
|
||||||
mainModule = main;
|
mainModule = main;
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ if (processArgs.processDisplayName) {
|
|||||||
setLoggerName(processArgs.processDisplayName);
|
setLoggerName(processArgs.processDisplayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processArgs.listenApi) {
|
function configureLogger() {
|
||||||
// configure logger
|
|
||||||
|
|
||||||
const logsFilePath = path.join(logsdir(), `${moment().format('YYYY-MM-DD-HH-mm')}-${process.pid}.ndjson`);
|
const logsFilePath = path.join(logsdir(), `${moment().format('YYYY-MM-DD-HH-mm')}-${process.pid}.ndjson`);
|
||||||
setLogsFilePath(logsFilePath);
|
setLogsFilePath(logsFilePath);
|
||||||
|
|
||||||
@@ -32,6 +30,10 @@ if (processArgs.listenApi) {
|
|||||||
setLogger(logger);
|
setLogger(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (processArgs.listenApi) {
|
||||||
|
configureLogger();
|
||||||
|
}
|
||||||
|
|
||||||
const shell = require('./shell');
|
const shell = require('./shell');
|
||||||
const dbgateTools = require('dbgate-tools');
|
const dbgateTools = require('dbgate-tools');
|
||||||
|
|
||||||
@@ -51,5 +53,6 @@ if (processArgs.listenApi) {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
...shell,
|
...shell,
|
||||||
getLogger,
|
getLogger,
|
||||||
|
configureLogger,
|
||||||
getMainModule: () => require('./main'),
|
getMainModule: () => require('./main'),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user