How to use the setGlobalLogLevel function from log4js

Find comprehensive JavaScript log4js.setGlobalLogLevel code examples handpicked from public code repositorys.

54
55
56
57
58
59
60
61
62
63
64


const initLogging = (logLevel, config) => {
  // log4js.configure() modifies exports.logconfig so check for equality first.
  const logConfigIsDefault = deepEqual(config, defaultLogConfig());
  log4js.configure(config);
  log4js.setGlobalLogLevel(logLevel);
  log4js.replaceConsole();
  // Log the warning after configuring log4js to increase the chances the user will see it.
  if (!logConfigIsDefault) logger.warn('The logconfig setting is deprecated.');
};
fork icon0
star icon0
watch icon1

+ 4 other calls in file

39
40
41
42
43
44
45
46
47
48
agentPromise = new Promise((resolve) => { agentResolve = resolve; });

if (!logLevel.isLessThanOrEqualTo(log4js.levels.DEBUG)) {
  logger.warn('Disabling non-test logging for the duration of the test. ' +
              'To enable non-test logging, change the loglevel setting to DEBUG.');
  log4js.setGlobalLogLevel(log4js.levels.OFF);
  logger.setLevel(logLevel);
}

// Note: This is only a shallow backup.
fork icon0
star icon0
watch icon0

+ 5 other calls in file