diff --git a/app.js b/app.js index b2d1e94b6..e694eb69d 100644 --- a/app.js +++ b/app.js @@ -73,8 +73,8 @@ app.use((req, res, next) => { `connect-src 'self' ${connectSrc};`, `img-src 'self' https:;`, `style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;`, - `script-src 'self' 'sha256-L6JyfNh6FtKC6umsFxtawnD4dtWi8szFRQZU0tVgsQk=' 'unsafe-eval' www.googletagmanager.com www.google-analytics.com;`, - `font-src 'self' https://fonts.gstatic.com`, + `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://tagmanager.google.com/ https://www.googletagmanager.com/ https://www.google-analytics.com/ http://*.cloudfront.net/ https://*.ipify.org/ https://*.crazyegg.com;`, + `font-src 'self' https://fonts.gstatic.com data:`, ].join(' '); /* eslint-enable */ diff --git a/config.js b/config.js index f525f1de9..06a68f374 100644 --- a/config.js +++ b/config.js @@ -55,7 +55,7 @@ config.cacheTTL = 20; // Collect logs (true - enabled, false - disabled) config.log.enabled = true; // Output for logs - can be device file or ordinary path -config.log.file = './logs/explorer.log'; +config.log.output = ['/dev/stdout', './logs/explorer.log']; // Log level - (trace, debug, info, warn, error) config.log.level = 'info'; diff --git a/known.json b/known.json index 33c5b5719..653c2008a 100644 --- a/known.json +++ b/known.json @@ -20,5 +20,7 @@ "2797034409072178585L" : { "owner" : "BitBay.net", "description" : "Withdrawal Wallet" }, "15610359283786884938L" : { "owner" : "Binance", "description" : "Hot Wallet" }, "14367838290034827614L" : { "owner" : "Coincheck.com", "description" : "Old Wallet" }, - "16293716040102736949L" : { "owner" : "Coincheck.com", "description" : "Main Wallet"} + "16293716040102736949L" : { "owner" : "Coincheck.com", "description" : "Main Wallet"}, + "9094944264474023843L" : { "owner" : "ICONOMI", "description" : "ICO Wallet"}, + "12167418142926850031L" : { "owner" : "Binance", "description" : "Main Wallet"} } diff --git a/package-lock.json b/package-lock.json index 4382044cc..14b46a83c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lisk-explorer", - "version": "2.2.0-alpha", + "version": "2.1.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d8f5bd610..db431a244 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lisk-explorer", - "version": "2.2.0-alpha", + "version": "2.1.6", "description": "Lisk blockchain explorer", "keywords": [ "lisk", diff --git a/utils/logger.js b/utils/logger.js index 3ca782e53..45c26f13b 100644 --- a/utils/logger.js +++ b/utils/logger.js @@ -19,8 +19,22 @@ const flatstr = require('flatstr'); const newConsole = require('console').Console; const config = require('../config'); -const output = fs.createWriteStream(config.log.file, { flags: 'a' }); -const myConsole = new newConsole(output, output); +const defaultOutput = '/dev/stdout'; + +if (!Array.isArray(config.log.output)) { + if (typeof config.log.output === 'string') { + config.log.output = [config.log.output]; + } else if (typeof config.log.file === 'string') { + config.log.output = [config.log.file]; + } else { + config.log.output = [defaultOutput]; + } +} + +const logOutputs = config.log.output.map((outputPath) => { + const fileOutput = fs.createWriteStream(outputPath, { flags: 'a' }); + return new newConsole(fileOutput, fileOutput); +}); const levels = { trace: 0, @@ -35,25 +49,24 @@ const logger = {}; logger.doLog = function doLog(level, msg, extra) { if (config.log.enabled) { const timestamp = Date.now(); - - // const stringMsg = typeof msg === 'string' ? msg : JSON.stringify(msg); - // const parsedMsg = stringMsg.replace(/(\r\n|\n|\r)/gm, ' '); + let outputString; if (extra) { const stringExtra = typeof extra === 'string' ? extra : JSON.stringify(extra); const parsedExtra = stringExtra.replace(/(\r\n|\n|\r)/gm, ' '); - myConsole.log(flatstr(safeStringify({ - level, - timestamp, - message: `${msg} ${parsedExtra}`, - }))); + outputString = `${msg} ${parsedExtra}`; } else { - myConsole.log(flatstr(safeStringify({ + outputString = msg; + } + + logOutputs.map((logOutput) => { + logOutput.log(flatstr(safeStringify({ level, timestamp, - message: msg, + message: outputString, }))); - } + return logOutput; + }); } };