From c8ba57f98b89346e61731550851e89debc4a871b Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Fri, 19 Aug 2016 15:18:42 -0400 Subject: [PATCH] added support for `dnt` flag when logging fallback query --- sanitiser/search_fallback.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sanitiser/search_fallback.js b/sanitiser/search_fallback.js index 03773dd5..1782dbdb 100644 --- a/sanitiser/search_fallback.js +++ b/sanitiser/search_fallback.js @@ -5,6 +5,7 @@ var sanitizeAll = require('../sanitiser/sanitizeAll'), var sanitize = function(req, cb) { sanitizeAll(req, sanitizers, cb); }; var logger = require('pelias-logger').get('api:controller:search_fallback'); +var logging = require( '../helper/logging' ); // middleware module.exports.middleware = function( req, res, next ){ @@ -17,7 +18,8 @@ module.exports.middleware = function( req, res, next ){ // log the query that caused a fallback since libpostal+new-queries didn't return anything if (req.path === '/v1/search') { - logger.info(req.clean.text); + var queryText = logging.isDNT(req) ? '[text removed]' : req.clean.text; + logger.info(queryText); } sanitize( req, function( err, clean ){