diff --git a/src/NewRelicLoggingService.js b/src/NewRelicLoggingService.js index e91ae7112..a43f09e51 100644 --- a/src/NewRelicLoggingService.js +++ b/src/NewRelicLoggingService.js @@ -18,18 +18,22 @@ function fixErrorLength(error) { class NewRelicLoggingService { static logInfo(message, customAttributes = {}) { + /* istanbul ignore next */ if (process.env.NODE_ENV === 'development') { - console.log(message); // eslint-disable-line + console.log(message, customAttributes); // eslint-disable-line } + /* istanbul ignore else */ if (window && typeof window.newrelic !== 'undefined') { window.newrelic.addPageAction('INFO', Object.assign({}, { message }, customAttributes)); } } static logError(error, customAttributes) { + /* istanbul ignore next */ if (process.env.NODE_ENV === 'development') { console.error(error, customAttributes); // eslint-disable-line } + /* istanbul ignore else */ if (window && typeof window.newrelic !== 'undefined') { // Note: customProperties are not sent. Presumably High-Security Mode is being used. window.newrelic.noticeError(fixErrorLength(error), customAttributes); diff --git a/src/logging.js b/src/logging.js index 64d5547c1..34b3402f0 100644 --- a/src/logging.js +++ b/src/logging.js @@ -36,8 +36,8 @@ function getLoggingService() { return loggingService; } -function logInfo(message) { - return getLoggingService().logInfo(message); +function logInfo(message, customAttributes) { + return getLoggingService().logInfo(message, customAttributes); } function logError(error, customAttributes) { diff --git a/src/logging.test.js b/src/logging.test.js index 3e62eaf9e..32657ec2b 100644 --- a/src/logging.test.js +++ b/src/logging.test.js @@ -36,8 +36,8 @@ describe('configured logging service', () => { const mockStatic = jest.fn(); NewRelicLoggingService.logInfo = mockStatic.bind(NewRelicLoggingService); - logInfo(arg1); - expect(mockStatic).toHaveBeenCalledWith(arg1); + logInfo(arg1, arg2); + expect(mockStatic).toHaveBeenCalledWith(arg1, arg2); }); });