Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit c7cf476

Browse files
groezing062088724
andauthored
enhance logging in handleAuth function and fix logging issue (#64)
* enhance logging in handleAuth function and fix logging issue * Set default for PauseMode = true Co-authored-by: 062088724 <062088724@DESKTOP-QA6FT6P.mshome.net>
1 parent f717aae commit c7cf476

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

provider/lib/authHandler.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@ const encryptFallBackKeyValue = process.env.CONFIG_WHISK_CRYPT_KEKF
99

1010
var tokenManagers = {};
1111

12-
function handleAuth(triggerData, options) {
12+
function handleAuth(triggerData, logger, options) {
1313

14+
var method = 'handleAuth';
15+
1416
if (triggerData.additionalData && triggerData.additionalData.iamApikey) {
1517
return new Promise(function (resolve, reject) {
1618
getToken(triggerData)
1719
.then(token => {
1820
options.auth = {bearer: token};
21+
logger.info(method, 'Received a valid token to send HTTP request to openwhisk for trigger: ', triggerData.id)
1922
resolve(options);
2023
})
2124
.catch(err => {
25+
logger.error(method, 'Error while receiving a token to send HTTP request to openwhisk');
2226
reject(err);
2327
});
2428
});

provider/lib/manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function (logger, triggerDB, redisClient) {
3939
this.redisField = constants.REDIS_FIELD;
4040
this.uriHost = 'https://' + this.routerHost;
4141
this.monitorStatus = {};
42-
this.pauseResumeEnabled = "false"; //* By default it is switched OFF
42+
this.pauseResumeEnabled = "true"; //* By default it is switched OFF
4343

4444
// Add a trigger: listen for changes and dispatch.
4545
this.createTrigger = function (triggerData, isStartup) {
@@ -570,7 +570,7 @@ module.exports = function (logger, triggerDB, redisClient) {
570570

571571
this.authRequest = function (triggerData, options, cb) {
572572

573-
authHandler.handleAuth(triggerData, options)
573+
authHandler.handleAuth(triggerData, logger, options)
574574
.then(requestOptions => {
575575
request(requestOptions, cb);
576576
})

provider/lib/pauseResume.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = function (logger, manager) {
4848
enabled: "false"
4949
});
5050
}else if ( req.query.enabled.length == 0 ){
51-
logger.error( method, 'Pause/Resume capability status queried by operator');
51+
logger.info( method, 'Pause/Resume capability status queried by operator');
5252
res.send({
5353
enabled: manager.pauseResumeEnabled
5454
});

0 commit comments

Comments
 (0)