Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: config option name not printing as application #128

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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