diff --git a/app.js b/app.js index 3a87478..40cb377 100755 --- a/app.js +++ b/app.js @@ -843,8 +843,14 @@ if (expressApp.get("env") === "local") { expressApp.use(function(req, res, next) { var time = Date.now() - req.startTime; var userAgent = req.headers['user-agent']; + var crawler = utils.getCrawlerFromUserAgentString(userAgent); + + if (crawler) { + debugAccessLog(`Finished action '${req.path}' (${res.statusCode}) in ${time}ms for crawler '${crawler}' / '${userAgent}'`); - debugAccessLog(`Finished action '${req.path}' (${res.statusCode}) in ${time}ms for UA '${userAgent}'`); + } else { + debugAccessLog(`Finished action '${req.path}' (${res.statusCode}) in ${time}ms for UA '${userAgent}'`); + } if (!res.headersSent) { next(); diff --git a/app/utils.js b/app/utils.js index 89f89c0..5a71c04 100644 --- a/app/utils.js +++ b/app/utils.js @@ -48,7 +48,8 @@ const crawlerBotUserAgentStrings = { "facebook": new RegExp("facebot", "i"), "alexa": new RegExp("ia_archiver", "i"), "aol": new RegExp("aolbuild", "i"), - "moz.com": new RegExp("dotbot", "i"), + "moz": new RegExp("dotbot", "i"), + "semrush": new RegExp("SemrushBot", "i") }; const ipMemoryCache = {}; diff --git a/bin/test.js b/bin/test.js new file mode 100644 index 0000000..3ab77a5 --- /dev/null +++ b/bin/test.js @@ -0,0 +1,21 @@ +const utils = require("../app/utils.js"); + +console.log("test"); + +global.activeBlockchain = "main"; + + + +(async () => { + const perfResults = {}; + + await utils.timePromise("abc", async () => { + const x = utils.estimatedSupply(4802177); + console.log("xxx: " + x); + + }, perfResults); + + console.log("perfResults: " + JSON.stringify(perfResults)); + + process.exit(0); +})(); diff --git a/package.json b/package.json index ed18da9..4ac48fa 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "bin": "bin/cli.js", "scripts": { "start": "node ./bin/www", + "test": "node ./bin/test.js", "miners": "node ./bin/refresh-mining-pool-configs.js", "integrity": "node ./bin/frontend-resource-integrity.js", "css-light-debug": "node-sass --output-style expanded --source-map scss --precision 6 ./public/scss/light.scss ./public/style/light.css",