Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logger = N.logger;
}
loggers[name] = logger;
}
return loggers[name] || log4js.getLogger(name);
};
//
// Load supported appenders
//
log4js.loadAppender('file');
log4js.loadAppender('console');
log4js.loadAppender('logLevelFilter');
//
// Helper that returns thresholded appender
// Resulting appender will log event with level => given `threshold` only
//
function thresholdedAppender(threshold, appender) {
var level = baseLevel;
if (threshold) {
level = log4js.levels.toLevel(threshold, baseLevel);
// get upper threshold
level = level.isGreaterThanOrEqualTo(baseLevel) ? level : baseLevel;
}
if (!logger) {
N.logger.warn('Logger <' + name + '> not found. Using .');
logger = N.logger;
}
loggers[name] = logger;
}
return loggers[name] || log4js.getLogger(name);
};
//
// Load supported appenders
//
log4js.loadAppender('file');
log4js.loadAppender('console');
log4js.loadAppender('logLevelFilter');
//
// Helper that returns thresholded appender
// Resulting appender will log event with level => given `threshold` only
//
function thresholdedAppender(threshold, appender) {
var level = baseLevel;
if (threshold) {
level = log4js.levels.toLevel(threshold, baseLevel);
// get upper threshold
level = level.isGreaterThanOrEqualTo(baseLevel) ? level : baseLevel;
const static = require('koa-static');
const mount = require('koa-mount');
const log4js = require('log4js');
const through2 = require('through2');
const mongoose = require('mongoose');
const redis = require('./utils/redis');
const cors = require('kcors');
const CONFIG = require('./config/config');
// init logger
//console log is loaded by default, so you won't normally need to do this
// log4js.loadAppender('console');
log4js.loadAppender('file');
// log4js.addAppender(log4js.appenders.console());
const date = new Date();
log4js.addAppender(log4js.appenders.file(path.resolve(__dirname, `logs/${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}.log`)));
const logger = log4js.getLogger('Core');
logger.setLevel('Debug');
// logger.trace('Entering cheese testing');
// logger.debug('Got cheese.');
// logger.info('Cheese is Gouda.');
// logger.warn('Cheese is quite smelly.');
// logger.error('Cheese is too ripe!');
// logger.fatal('Cheese was breeding ground for listeria.');
logger.info('Server starting...');
if (!chosenLogger) {
N.logger.warn('Logger <%s> not found. Using .', name);
chosenLogger = N.logger;
}
channels[name] = chosenLogger; // cache
return chosenLogger;
};
//
// Load supported appenders
//
log4js.loadAppender('file');
log4js.loadAppender('console');
log4js.loadAppender('clustered');
log4js.loadAppender('logLevelFilter');
//
// clear default loggers
//
log4js.clearAppenders();
function clusteredAppender(children, category) {
let clusterAppenderConfig = {
appenders: [], // configs
actualAppenders: [] // functions
};
children.forEach(appender => {
addFileAppender: function(path) {
if (!log4js.appenders.file) {
log4js.loadAppender('file');
}
var appender = log4js.appenders.file(path, null /* default layout*/, 2097152 /* 2mb max size */, 1 /* 1 backup */);
var filter = new logLevelFilter('INFO', appender);
log4js.addAppender(filter);
},
if (!chosenLogger) {
N.logger.warn('Logger <%s> not found. Using .', name);
chosenLogger = N.logger;
}
channels[name] = chosenLogger; // cache
return chosenLogger;
};
//
// Load supported appenders
//
log4js.loadAppender('file');
log4js.loadAppender('console');
log4js.loadAppender('clustered');
log4js.loadAppender('logLevelFilter');
//
// clear default loggers
//
log4js.clearAppenders();
function clusteredAppender(children, category) {
let clusterAppenderConfig = {
appenders: [], // configs
actualAppenders: [] // functions
};
children.forEach(appender => {
clusterAppenderConfig.appenders.push({ category });
module.exports = function (next) {
log4js.loadAppender('file');
log4js.addAppender(log4js.appenders.file(
require('path').join(LOGS_PATH, nodeca.runtime.env + '.log')
), 'general');
nodeca.logger = log4js.getLogger('general');
next();
};
//DEBUG OPTIONS
GLOBAL.debug_sequelize_enabled = false;//Default: false
GLOBAL.debug_tweets = false;//Default: false
//END DEBUG OPTIONS
//setup Dependencies
var connect = require('connect')
, express = require('express')
, http = require('http')
, port = (process.env.PORT || 8081)
, log4js = require('log4js');
log4js.replaceConsole();
log4js.loadAppender('file');
log4js.addAppender(log4js.appenders.file('logs/footweet.log'), 'footweet');
GLOBAL.logger = log4js.getLogger('footweet');
GLOBAL.db = require('./storage/DatabaseConnection');
//Setup Express
var app = express();
var server = http.createServer(app);
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view options', { layout: false });
app.use(connect.bodyParser());
app.use(express.cookieParser());
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
const path = require('path');
const log4js = require('log4js');
const conf = require('./conf');
if (process.env.NODE_ENV === 'development') {
log4js.setGlobalLogLevel('debug');
} else if (process.env.NODE_ENV === 'production') {
log4js.setGlobalLogLevel(process.env.LOG_LEVEL || 'info');
}
log4js.replaceConsole();
log4js.loadAppender('console');
log4js.loadAppender('file');
const set = new Set();
const logFile = log4js.appenders.file(
path.join(__dirname, conf.logger.relativePath)
);
log4js.addLogger = name => {
if (!set.has(name)) {
set.add(name);
log4js.addAppender(logFile, name);
}
return log4js.getLogger(name);
};
const signupFile = log4js.appenders.file(
path.join(__dirname, '/../logs/signuplog.log')
function getLogger(dir){
log4js.loadAppender('file');
log4js.appenders['TASK'] = [];
var appender = log4js.appenders.file(dir + "/tast.log");
if(log4js.hasLogger("TASK")){
log4js.getLogger('TASK').removeAllListeners();
}
log4js.addAppender(appender,'TASK');
return log4js.getLogger('TASK');
}