Skip to content

Commit

Permalink
Fix: config option name not printing as application; Minor grammar fi…
Browse files Browse the repository at this point in the history
…x for unsupported logger error (#128)
  • Loading branch information
DeanAyalon authored Apr 5, 2024
1 parent 15a82eb commit 79f3ce6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/decorators/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ export default class FunctionDecorator extends BaseFunctionDecorator {
resultSanitizer,
errorSanitizer,
contextSanitizer,
timestamp
timestamp,
name
} = this.config;

const basicLogObject = {
application : name,
service : this.config.serviceName,
method : methodName,
application : this.name
method : methodName
};

const buildLogObject = (level, obj) => {
Expand All @@ -65,7 +66,7 @@ export default class FunctionDecorator extends BaseFunctionDecorator {

if (isFunction(logger)) return logger(lev, dat);
if (isFunction(logger[lev])) return logger[lev](dat);
throw new Error(`logger not supports ${lev} level`);
throw new Error(`logger does not support ${lev} level`); // Alternatively - logger level ${lev} not supported
};

const time = startBenchmark();
Expand Down
2 changes: 1 addition & 1 deletion tests/package/configurations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ test('Negative: broken logger', function () {

assert.throws(() => {
decorated(5, 9);
}, Error, 'logger not supports');
}, Error, 'logger does not support');
});

test('Positive: function logger', function () {
Expand Down

0 comments on commit 79f3ce6

Please sign in to comment.