Skip to content

Commit

Permalink
Fixed all log levels.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTV12345 committed Oct 22, 2023
1 parent 0c3e3a8 commit 188d586
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/node/utils/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,24 @@ const nonSettings = [

// This is a function to make it easy to create a new instance. It is important to not reuse a
// config object after passing it to log4js.configure() because that method mutates the object. :(
const defaultLogConfig = () => ({appenders: { console: { type: 'console' } },
categories:{
default: { appenders: ['console'], level: 'info'}
const defaultLogConfig = () => ({appenders: {console: {type: 'console'}},
categories: {
default: {appenders: ['console'], level: 'info'},
}});
const defaultLogLevel = 'INFO';

const initLogging = (logLevel, config) => {
// log4js.configure() modifies exports.logconfig so check for equality first.
const logConfigIsDefault = deepEqual(config, defaultLogConfig());
log4js.configure(config);
log4js.getLogger("console");
console.log = logger.info.bind(logger)
log4js.getLogger('console');

// Overwrites for console output methods
console.debug = logger.debug.bind(logger);
console.log = logger.info.bind(logger);
console.warn = logger.warn.bind(logger);
console.error = logger.error.bind(logger);

// Log the warning after configuring log4js to increase the chances the user will see it.
if (!logConfigIsDefault) logger.warn('The logconfig setting is deprecated.');
};
Expand Down

0 comments on commit 188d586

Please sign in to comment.