@aircall/logger
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.5.0](http://bitbucket.org/aircall/front-end-modules/compare/@aircall/logger@2.4.0...@aircall/logger@2.5.0) (2020-04-15) | ||
### Features | ||
* **logger:** add setContext method to Logger ([f263fe0](http://bitbucket.org/aircall/front-end-modules/commits/f263fe0ce20ef2b8b4e2045f89e4f805326bd167)) | ||
# [2.4.0](http://bitbucket.org/aircall/front-end-modules/compare/@aircall/logger@2.3.4...@aircall/logger@2.4.0) (2020-04-10) | ||
@@ -8,0 +19,0 @@ |
@@ -35,2 +35,3 @@ import { StatusType } from '@datadog/browser-logs'; | ||
init({ level, context, token }: LoggerInitOptions): void; | ||
setContext(context: UserContext): void; | ||
private logOrEnqueue; | ||
@@ -37,0 +38,0 @@ setLevel(level: StatusType): void; |
@@ -32,3 +32,3 @@ "use strict"; | ||
}); | ||
browser_logs_1.datadogLogs.logger.setContext(context); | ||
this.setContext(context); | ||
browser_logs_1.datadogLogs.logger.setHandler(isDevelopment ? browser_logs_1.HandlerType.console : browser_logs_1.HandlerType.http); | ||
@@ -39,2 +39,6 @@ this.setLevel(level); | ||
} | ||
// set logger context | ||
setContext(context) { | ||
browser_logs_1.datadogLogs.logger.setContext(context); | ||
} | ||
// Send logs or enqueue them if the SDK isn't initialized | ||
@@ -41,0 +45,0 @@ logOrEnqueue(fn) { |
{ | ||
"name": "@aircall/logger", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"main": "dist/index.js", | ||
@@ -14,3 +14,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "502f9740c2e8b1cc5f2b746bcf8524529605a83d", | ||
"gitHead": "202b20d0d5963f933cef040ec5f58403aad5d719", | ||
"dependencies": { | ||
@@ -17,0 +17,0 @@ "@datadog/browser-logs": "1.7.3", |
@@ -35,7 +35,9 @@ jest.mock('@datadog/browser-logs'); | ||
it('should set properties', (): void => { | ||
jest.spyOn(logger, 'setContext'); | ||
const context = { | ||
service: 'phone', | ||
user_session | ||
}; | ||
logger.init({ | ||
context: { | ||
service: 'phone', | ||
user_session | ||
}, | ||
context, | ||
token, | ||
@@ -53,2 +55,4 @@ level: LOGGER_LEVEL.debug | ||
}); | ||
expect(logger.setContext).toHaveBeenCalledWith(context); | ||
expect(datadogLogs.logger.setContext).toHaveBeenCalledWith(context); | ||
}); | ||
@@ -55,0 +59,0 @@ }); |
@@ -59,3 +59,3 @@ import { datadogLogs as sdk, StatusType, HandlerType } from '@datadog/browser-logs'; | ||
sdk.logger.setContext(context); | ||
this.setContext(context); | ||
sdk.logger.setHandler(isDevelopment ? HandlerType.console : HandlerType.http); | ||
@@ -68,2 +68,7 @@ | ||
// set logger context | ||
public setContext(context: UserContext) { | ||
sdk.logger.setContext(context); | ||
} | ||
// Send logs or enqueue them if the SDK isn't initialized | ||
@@ -70,0 +75,0 @@ private logOrEnqueue(fn: Function): void { |
Sorry, the diff of this file is not supported yet
46626
998