Skip to content

Commit

Permalink
Merge pull request #3481 from Countly/chore/logger-debug-logs
Browse files Browse the repository at this point in the history
add debug logs to request logs
  • Loading branch information
kanwarujjaval authored Sep 7, 2022
2 parents 3b151e6 + 6ddfafd commit b557433
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/logger/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var exported = {},
common = require('../../../api/utils/common.js'),
plugins = require('../../pluginManager.js'),
automaticStateManager = require('./helpers/automaticStateManager'),
log = require('../../../api/utils/log.js')('logger:api'),
{ validateRead } = require('../../../api/utils/rights.js');

const FEATURE_NAME = 'logger';
Expand Down Expand Up @@ -46,7 +47,10 @@ plugins.setConfigs("logger", {
};

var processSDKRequest = function(params) {
log.d("Explicitly set logging_is_allowed => ", params.logging_is_allowed);
const requestLoggerConfiguration = getRequestLoggerConfiguration(params);
log.d("Logging config => ", requestLoggerConfiguration);
log.d("Should Log request? => ", shouldLogRequest(requestLoggerConfiguration));
if (params.logging_is_allowed && shouldLogRequest(requestLoggerConfiguration)) {
params.log_processed = true;
var now = new Date().getTime();
Expand Down Expand Up @@ -252,6 +256,8 @@ plugins.setConfigs("logger", {
res: response
};

log.d("problems found", problems);

plugins.dispatch("/log", { params: params, insertData: insertData, problems: problems }, function() {
//Set problems after log event dispatched
insertData.p = (problems.length) ? problems : false;
Expand Down

0 comments on commit b557433

Please sign in to comment.