Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const SimpleNodeLogger = require('simple-node-logger');
const moment = require('moment');
const cheerio = require('cheerio');
const charset = require('superagent-charset');
const request = require('superagent');
const fs = require('fs');
const urlencode = require('urlencode');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
charset(request);
const opts = {
logFilePath: `logs/article-log-${moment().format('YYYY-MM-DD')}.log`,
timestampFormat: 'YYYY-MM-DD HH:mm:ss',
};
const log = SimpleNodeLogger.createSimpleLogger(opts);
// 获取小说内容并打包成txt文件
const getContent = (index, charterList, articleUrl, articleName) => {
log.info(`get charter ${charterList[index].title} content ...`);
request.get(articleUrl + charterList[index].href)
.charset('gbk')
.end((error, resp) => {
if (error) {
log.error(`get charter ${charterList[index].title} error : `, error);
} else {
log.info(`get charter ${charterList[index].title} success !`);
const $ = cheerio.load(resp.text);
const content = charterList[index].title + '\n' + unescape($($('#BookText')[0]).html()
.replace(/&#x/g, '%u')
.replace(/;/g, '')
.replace(/%uA0/g, ' ')
*/
const config = require('../../config.js'),
pkg = require('../../package.json'),
chalk = require('chalk'),
_ = require('underscore'),
fileLog = config.logToFile,
consoleLog = config.logToConsole;
let log = {}
if(fileLog){
const SimpleNodeLogger = require('simple-node-logger'),
opts = {
logFilePath:'evol-'+(new Date()).toISOString().substring(0, 10)+'.log',
timestampFormat:'YYYY-MM-DD HH:mm:ss.SSS'
}
log = SimpleNodeLogger.createSimpleLogger( opts );
}
const asciiArt =
` ______ _ _ _ _
| ____| | | /| (_) (_)/|
| |____ _____ | |_ _| |_ _| |_| |_ _ _
| __\\ \\ / / _ \\| | | | | __| | | | __| | | |
| |___\\ V / (_) | | |_| | |_| | | | |_| |_| |
|______\\_/ \\___/|_|\\__,_|\\__|_|_|_|\\__|\\__, |
___ ___ _ ____ _____ _ __ __/ |
____ / __|/ _ \\ \'__\\ \\ / / _ \\ \'__| |___/
|____| \\__ \\ __/ | \\ V / __/ |
|___/\\___|_| \\_/ \\___|_| v`+pkg.version
function green(msg){
/**
* Import base packages
*/
const log = require('simple-node-logger').createSimpleLogger('./csgo-matchmaking.log');
const config = require("../config/config");
/**
* Set log level from config
*/
log.setLevel(config.application.logLevel);
module.exports = log;
var util = require('util')
var express = require('express');
var bodyParser = require('body-parser');
const path = require('path');
var log = require('simple-node-logger').createSimpleLogger('emulator.log');
var port = process.argv[2];
var app = express();
var jsonfile = require('jsonfile');
var fs = require('fs');
var server;
var DEPLOYED_FUNCTIONS_FILE = './functions.json';
app.use(logErrors);
app.use(bodyParser.json());
app.use(bodyParser.raw());
app.use(bodyParser.text());
app.use(bodyParser.urlencoded({
extended: true
}));
/**
* Create callback storage for socket
*/
const callbacks = [];
/**
* Create log dir if it doesn't exists
*/
if (!fs.existsSync(`${dev ? __dirname + '/../' : process.cwd() + '/'}${config.logger.location}`)){
fs.mkdirSync(`${dev ? __dirname + '/../' : process.cwd() + '/'}${config.logger.location}`);
}
/**
* Setup logger
*/
const log = require('simple-node-logger').createSimpleLogger({
logFilePath: `${dev ? __dirname + '/../' : process.cwd() + '/'}${config.logger.location}/server.log`,
timestampFormat: 'YYYY-MM-DD HH:mm:ss.SSS'
});
/**
* Set log level from config
*/
log.setLevel(config.logger.level);
/**
* Fix zero prefixing
*
* @param number
* @return {*}
*/
const fixTimeDateCalculation = (number) => {
const http = require('http');
const SpotifyWebHelper = require('spotify-web-helper');
const config = require('./config');
/**
* Check if we are using the dev version
*/
const dev = process.env.NODE_ENV !== 'production';
/**
* Init logger and set log level
*/
global.log = require('simple-node-logger').createSimpleLogger({
logFilePath: `${dev ? __dirname : process.cwd()}/csgo-gamestate-spotify.log`,
timestampFormat: 'YYYY-MM-DD HH:mm:ss.SSS'
});
global.log.setLevel(config.application.logLevel);
/**
* Create a new Spotify helper
*/
const spotifyHelper = SpotifyWebHelper();
/**
* Global vars
* @type {boolean}
*/
let spotifyReady = false;
let isPlaying = false;
'use strict'
const logger = require('simple-node-logger').createSimpleLogger()
const nconf = require('nconf')
const fs = require('fs')
const LAST_BLOCK_FILE = '.lastblock'
let pushers = null
nconf.argv().env('__')
nconf.defaults({conf: `${__dirname}/config.json`})
nconf.file(nconf.get('conf'))
const api = require('./lib/eosApi')(nconf.get('eosApi'), nconf.get('eosHistoryApi'), nconf.get('apiTimeout'))
const actions = require('./lib/actions')(nconf.get('accounts'))
const watchInterval = nconf.get('watchInterval')
var http = require('http');
var log = require('simple-node-logger').createSimpleLogger('project.log');
var logger = require('morgan');
var bodyParser = require('body-parser');
var async = require("asyncawait/async");
var await = require("asyncawait/await");
var express = require('express');
var bot = require("./facebook_bot/bot");
var app = express();
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: false
}));
var server = http.createServer(app);