Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable func-names, prefer-arrow-callback, no-unused-expressions */
// Third party components
const {expect} = require('chai');
const logger = require('winston');
// Local components
const SchemaRoute = require('../../../app/routes/schemas');
// Setup
logger.level = 'error';
describe('routes/schemas.js', function () {
describe('Route', function () {
it('should define a parameter handler for Collection parameter', function (done) {
const app = {
use: (router) => {
expect(router).to.have.property('params');
expect(router.params).to.have.property('Collection');
done();
}
};
SchemaRoute(app);
});
before(function () {
// Disable logging.
winston.level = 'none';
});
}).then(() => {
// set log level
logger.info('[app] Setting log level to "%s".', config.vpdb.logging.level);
logger.level = config.vpdb.logging.level;
// now we start the server.
logger.info('[app] Starting Express server at %s:%d', app.get('ipaddress'), app.get('port'));
app.listen(app.get('port'), app.get('ipaddress'), function() {
logger.info('[app] Storage API ready at %s', settings.storageProtectedUri());
logger.info('[app] API ready at %s', settings.apiUri());
if (process.send) {
process.send('online');
}
});
}).catch(err => {
logger.error('[app] ERROR: %s', err.message);
return () => {
if (process.env.NODE_ENV === 'development' || program.debug) {
winston.level = 'debug';
}
// Don't require config until after NODE_ENV has been set
const config = require('config');
log.debug('Config environment is %s', config.util.getEnv('NODE_ENV'));
_.defaults(program, {
cwd: process.cwd(),
customerId: process.env.AERO_CUSTOMER,
subCommand: (commandOptions || {}).subCommand
});
// Run the command
require('../lib/cli-init')(program, commandOptions)
.then(() => command(program))
const winston = require('winston')
winston.level = 'debug'
const logger = new (winston.Logger)({
transports: [
// colorize the output to the console
new (winston.transports.Console)({
colorize: true,
prettyPrint: true
})
]
})
module.exports = logger
var winston=Â require('winston');
winston.level = 'silly';
function logFn(type) {
return (callback) => {
winston.log(type, `test ${type}`);
callback();
}
}
function logFn2(type) {
return (callback) => {
winston[type](`test ${type}`);
callback();
}
}
beforeEach(function() {
logLevel = log.level;
log.level = 'warn';
defaultConfig = new Config({ array: [ 'a', 'b' ] });
mockConfigFile = function(config) {
config.a = 'x';
config.array[1] = 'y';
return config;
};
requireSpy = jasmine.createSpy('require').andReturn(mockConfigFile);
oldRequire = configurer.__get__('require');
configurer.__set__('require', requireSpy);
});
constructor() {
winston.level = config.logLevel;
ATHENZ_TOKEN_MAX_EXPIRY = (Number(config.tokenMaxExpiry) > 30 * 24 * 60 * 60) ? 30 * 24 * 60 * 60 : Number(config.tokenMaxExpiry);
ATHENZ_TOKEN_NO_EXPIRY = config.tokenNoExpiry;
this._unsignedToken = null;
this._signedToken = null;
this._version = null;
this._salt = null;
this._host = null;
this._ip = null;
this._domain = null;
this._signature = null;
this._keyId = '0';
this._expiryTime = 0;
this._timestamp = 0;
this._digestAlgorithm = 'SHA256';
import winston from 'winston'
winston.level = process.env.LOG_LEVEL || 'info'
const handleExceptions = process.env.NODE_ENV !== 'dev'
const logger = winston.createLogger({
level: winston.level,
transports: [
new winston.transports.Console({
handleExceptions,
humanReadableUnhandledException: handleExceptions,
level: 'debug'
})
],
exitOnError: false
})
export default logger