Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('\n\n ** Logging utility tests - test setting an external logger based on bunyan **\n\n', (t) => {
console.log(' ***** logger.js - test bunyan *****'); // eslint-disable-line
const logger = bunyan.createLogger({name: 'bunyanLogger'});
hfc.setLogger(logger);
testLogger(t);
t.end();
});
site.use(cookieParser());
site.use(expressSession({
secret: settings.sessionSecret,
key: packagejson.name + ".sid",
saveUninitialized: false,
resave: false,
cookie: {
maxAge: 2592000 * 1000, // 30 days in ms
path: '/',
secure: (settings.NODE_ENV === "live"),
domain: settings.NODE_ENV === "live" ? settings.live_domain : settings.dev_domain
}
}));
// Configure logging
log = bunyan.createLogger({name: "shorten-node",
streams: [{
level: "trace", // Priority of levels looks like this: Trace -> Debug -> Info -> Warn -> Error -> Fatal
stream: process.stdout, // Developers will want to see this piped to their consoles
}]});
site.set('bunyan', log);
/*
** Sever specific configuration
*/
//Dev mode
if (settings.NODE_ENV === "dev"){
//Set your domain name for your development environment
site.set('domain', settings.dev_domain);
log.debug("Running in dev mode");
mongoose.connect(settings.dev_mongodb_uri, {useNewUrlParser: true, useUnifiedTopology: true});
}else if (settings.NODE_ENV === "test"){
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var passport = require('passport');
var util = require('util');
var bunyan = require('bunyan');
var config = require('./config');
// set up database for express session
var MongoStore = require('connect-mongo')(expressSession);
var mongoose = require('mongoose');
// Start QuickStart here
var OIDCStrategy = require('passport-azure-ad').OIDCStrategy;
var log = bunyan.createLogger({
name: 'Microsoft OIDC Example Web Application'
});
/******************************************************************************
* Set up passport in the app
******************************************************************************/
//-----------------------------------------------------------------------------
// To support persistent login sessions, Passport needs to be able to
// serialize users into and deserialize users out of the session. Typically,
// this will be as simple as storing the user ID when serializing, and finding
// the user by ID when deserializing.
//-----------------------------------------------------------------------------
passport.serializeUser(function(user, done) {
done(null, user.oid);
});
import http from 'http'
import path from 'path'
import fs from 'fs'
import bodyParser from 'body-parser'
import express from 'express'
import cors from 'cors'
import throng from 'throng'
import bunyan from 'bunyan'
import Routes from '../libs/Routes'
import config from '../config'
const app = express()
const httpServer = http.Server(app)
const log = bunyan.createLogger(config.logger.options)
export default async function startApp() {
try {
const routes = await Routes.get()
//view engine setup
app.set('views', path.join(__dirname, '..', 'views'))
app.set('view engine', 'pug')
app.use(bodyParser.urlencoded({extended: true, limit: '1mb'}))
app.use(bodyParser.json({limit: '1mb'}))
// All routes should be CORS enabled
app.use(cors())
//static files
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";
var assert = require('assert');
var _ = require("./helpers");
var ThingArray = require("./thing_array").ThingArray;
var bunyan = require('bunyan');
var logger = bunyan.createLogger({
name: 'iotdb',
module: 'transmogrifier',
});
/* --- constants --- */
var VERBOSE = true;
/**
* A 'Transmogrifier' changes the way a Thing works
* or appears in interface. It lets you do
* stuff like:
* <ul>
* <li>convert Fahrenheit to Celsius for all values
* </li><li>delay sending an event for a certain
* period of time
* </li></ul>
'use strict';
var java = require('java');
var bunyan = require('bunyan');
java.classpath.push('./jars/WebJContextor.jar');
java.classpath.push('./jars/CCOWContextWrapper.jar');
java.classpath.push('./jars/commons-lang3-3.3.2.jar');
var config = require('./config.js');
var logger = bunyan.createLogger(config.logger);
function setContext(paramBlob, mContextManagerUrl, participantUrl) {
var initializeContext = java.newInstanceSync('com.sentillion.sdkweb.webcontextor.WebContextor');
var blob = java.newArray('java.lang.String', [null]);
blob[0] = java.callMethodSync(initializeContext, 'getLastContextBlob');
var contextItems = [];
var _state = 0,
dfn = '',
icn = '',
participantCoupon = '',
contextCoupon = '',
jsonData = {};
if (blob[0] === '' && paramBlob !== '') {
blob[0] = paramBlob;
}
'use strict';
/*jshint -W003 */
var Client = require('../lib/client');
var udpServer = require('./tools/udp-server');
var httpsServer = require('./tools/https-server');
var logger = require('bunyan').createLogger({ name: 'tests' });
var expect = require('chai').expect;
describe('When sending counter metrics', function () {
var httpPort = Math.floor(Math.random() * 10000) + 11025;
var udpPort = Math.floor(Math.random() * 10000) + 1024;
var apiConf = {
host: '127.0.0.1',
port: httpPort,
token: 'my-token'
};
var victim = new Client(
{
systemStats: false,
transport: 'udp',
function AnalysisLogger(stream, user) {
this.logger = bunyan.createLogger({
name: 'camshaft',
streams: [{
level: 'info',
stream: stream || process.stdout
}]
});
this.user = user;
}
function createLogger(name) {
return bunyan.createLogger({
name: name,
serializers: SERIALIZERS,
streams: [
{
level: 'warn',
stream: process.stderr
},
{
level: 'debug',
type: 'raw',
stream: new RequestCaptureStream({
stream: process.stderr
})
}
]
});
import moment from 'moment-timezone';
import bunyan from 'bunyan';
import bunyanPretty from 'bunyan-pretty';
import Raven from 'raven';
import cookieParser from 'cookie-parser';
import render from './render';
import config from './env';
import healthCheck from './health';
moment.locale('nb-NO');
const app = express();
app.use(Raven.requestHandler());
app.use(cookieParser());
const log = bunyan.createLogger({
name: 'lego-webapp',
release: config.release,
stream: process.stdout.isTTY ? bunyanPretty() : process.stdout,
environment: config.environment
});
app.set('host', config.host || '0.0.0.0');
app.set('port', config.port || 3000);
app.set('log', log);
const webpackClient = require('../config/webpack.client.js');
if (__DEV__) {
const compiler = require('webpack')(
webpackClient(undefined, {
mode: 'development'