mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
electron-97: fixed logging issues for unit tests and added documentation in the README
This commit is contained in:
parent
1819b7f82d
commit
b502d65de2
@ -57,5 +57,11 @@ In order to achieve those goals Symphony is participating and working in close c
|
||||
- code coverage reports are placed in dir: converage
|
||||
- tests are located in dir: tests
|
||||
|
||||
## Logging
|
||||
- Local logging is enabled for dev environments using the module [electron-log](https://www.npmjs.com/package/electron-log)
|
||||
- On macOS, the logs are stored under `~/Library/Logs/<app name>/log.log`
|
||||
- On Windows, the logs are stored under `%USERPROFILE%\AppData\Roaming\<app name>\log.log`
|
||||
- Remote logging is enabled for local and production cases and are sent to the backend server via the remote objects
|
||||
|
||||
## Misc notes
|
||||
If desiring to run against server without proper cert use cmd line option: --ignore-certificate-errors
|
||||
|
10
js/log.js
10
js/log.js
@ -1,13 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const electronLog = require('electron-log');
|
||||
|
||||
const getCmdLineArg = require('./utils/getCmdLineArg.js');
|
||||
const { isDevEnv } = require('./utils/misc');
|
||||
const logLevels = require('./enums/logLevels.js');
|
||||
|
||||
const MAX_LOG_QUEUE_LENGTH = 100;
|
||||
|
||||
let electronLog;
|
||||
|
||||
class Logger {
|
||||
|
||||
constructor() {
|
||||
@ -18,7 +18,9 @@ class Logger {
|
||||
this.logQueue = [];
|
||||
|
||||
// Initializes the local logger
|
||||
initializeLocalLogger();
|
||||
if (isDevEnv) {
|
||||
initializeLocalLogger();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,6 +101,8 @@ let loggerInstance = new Logger();
|
||||
* Initializes the electron logger for local logging
|
||||
*/
|
||||
function initializeLocalLogger() {
|
||||
// eslint-disable-next-line global-require
|
||||
electronLog = require('electron-log');
|
||||
electronLog.transports.file.level = 'debug';
|
||||
electronLog.transports.file.format = '{h}:{i}:{s}:{ms} {text}';
|
||||
electronLog.transports.file.maxSize = 10 * 1024 * 1024;
|
||||
|
Loading…
Reference in New Issue
Block a user