Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var log = require('loglevel')
var validator = require('validator')
var errorHandlers = require('../common/errorHandlers')
var settings = require('../common/settings.js')
// Change this to alter how much information is printed out
log.setLevel('trace')
log.enableAll()
console.log('server.js: Starting server.js')
console.log('server.js: Will require db.js')
try {
var app = require('../common/microService.js')
var db = require('../common/db.js')(log)
// add query handler API
require('./serverApi.js')(app, db, log, validator) // configure our routes
// add test query handler API
require('../tester/testerApi.js')(app, db, log, validator) // configure our routes
// Set port to 8080
var port = settings.ETHEROSCOPESERVER.slice(-4)
define(function (require, exports, module) {
"use strict";
var loglevel = require("loglevel");
/*eslint no-console:0*/
if (__PG_DEBUG__) {
// If the debug global is set, log messages at and below debug level
loglevel.enableAll();
if (!loglevel.hasOwnProperty("table")) {
loglevel.table = console.table.bind(console);
}
} else {
// Otherwise, only log information, warnings and errors
loglevel.setLevel(loglevel.levels.INFO);
}
if (!loglevel.hasOwnProperty("timeStamp")) {
loglevel.timeStamp = console.timeStamp.bind(console);
}
module.exports = loglevel;
});
var fs = require('fs');
var util = require('util');
var moment = require('moment');
// #### logging decoration ####
// see https://github.com/kutuluk/loglevel-plugin-prefix
const colors = {
TRACE: chalk.magenta,
DEBUG: chalk.cyan,
INFO: chalk.blue,
WARN: chalk.yellow,
ERROR: chalk.red,
};
prefix.reg(log);
log.enableAll();
prefix.apply(log, {
format(level, name, timestamp) {
return `${chalk.gray(`[${timestamp}]`)} ${colors[level.toUpperCase()](level)} ${chalk.green(`${name}:`)}`;
},
});
const WRITE_LOG = true;
var logBuf = "";
function writeLog(callback) {
if (logBuf && WRITE_LOG) {
fs.appendFile("log/" + moment(new Date()).format("MM-DD"), logBuf, function(err) {
if (err) console.log("ERROR, could not write log to file log/" + moment(new Date()).format("MM-DD") + " : " + err);
if (callback) callback();
});
const morgan = require('morgan')
const log = require('loglevel')
const http = require('http')
const express = require('express')
const bodyParser = require('body-parser')
const socketIO = require('socket.io')
const settings = require('../common/settings')
const DataPointsSender = require('./dataPointsSender')
const socketPort = settings.dataPointsService.socketPort
log.enableAll()
const app = express()
// set CORS
app.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', settings.allowedOrigin)
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
next()
})
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: true}))
app.use(morgan('dev'))
const server = http.createServer(app)
server.listen(socketPort)
// eslint-disable-next-line import/no-extraneous-dependencies
const log = require('loglevel');
// eslint-disable-next-line import/no-extraneous-dependencies
const chalk = require('chalk');
const prefix = require('../lib/loglevel-plugin-prefix');
const colors = {
TRACE: chalk.magenta,
DEBUG: chalk.cyan,
INFO: chalk.blue,
WARN: chalk.yellow,
ERROR: chalk.red,
};
prefix.reg(log);
log.enableAll();
prefix.apply(log, {
format(level, name, timestamp) {
return `${chalk.gray(`[${timestamp}]`)} ${colors[level.toUpperCase()](level)} ${chalk.green(`${name}:`)}`;
},
});
prefix.apply(log.getLogger('critical'), {
format(level, name, timestamp) {
return chalk.red.bold(`[${timestamp}] ${level} ${name}:`);
},
});
log.trace('trace');
log.debug('debug');
log.getLogger('critical').info('Something significant happened');
export const updateLogLevel = () => {
const isDebugMode = getSettings("isDebugMode");
if (isDebugMode) log.enableAll();
else log.disableAll();
};
import loglevel from 'loglevel';
loglevel.enableAll();
/**
* @namespace flatworld
* @class log
* @requires loglevel.js for frontend logging, or something similar
**/
const log = {
debug(e) {
loglevel.debug(e);
},
warn(e) {
loglevel.warn(e);
},
error(e) {
loglevel.error(e);
}
};
const amqp = require('amqplib/callback_api')
const log = require('loglevel')
const Parity = require('../common/parity')
const Promise = require('bluebird')
const errorHandler = require('../common/errorHandlers')
const settings = require('../common/settings')
const db = require('../db')
log.enableAll()
const parity = Parity(db, log)
const opt = { credentials: require('amqplib').credentials.plain(settings.RABBITMQ.user,
settings.RABBITMQ.password) }
/**
* Function responsible for caching all variables' values in a given range [from, upTo]
*
* Consists of 4 steps
* Step 1 - parity,getHistory call (getting events in a given range)
* Step 2 - caching blocks' timestamps
* Step 3 - caching transactions
* Step 4 - caching values for each variable
*
* @param contractInfo
* @param variables
import React from 'react';
import ReactDOM from 'react-dom';
import {Routes} from "./components";
import {MuiPickersUtilsProvider} from '@material-ui/pickers';
import DateFnsUtils from '@date-io/date-fns';
import {ThemeProvider} from "@material-ui/styles";
import {theme} from './theme';
import {CssBaseline} from "@material-ui/core";
import log from "loglevel";
log.enableAll();
ReactDOM.render(
,
document.getElementById("content"));