talend-log
Advanced tools
Comparing version 0.63.0 to 0.63.1
{ | ||
"name": "talend-log", | ||
"description": "Small wrapper over TraceKit, that allows to inject error reporting as redux-logger middleware", | ||
"main": "lib/index.js", | ||
"main": "lib/errorTransformer.js", | ||
"scripts": { | ||
@@ -50,3 +50,3 @@ "prepublish": "babel -d lib ./src/", | ||
"peerDependencies": {}, | ||
"version": "0.63.0", | ||
"version": "0.63.1", | ||
"dependencies": { | ||
@@ -53,0 +53,0 @@ "tracekit": "^0.4.4", |
@@ -16,3 +16,3 @@ # Talend-log - error logging library | ||
import LOGGING_SERVER_URL from 'somewhere'; | ||
import initErrorTransformer from './src/errorTransformer'; | ||
import initErrorTransformer, { TraceKit } from 'talend-log'; | ||
@@ -35,3 +35,3 @@ // important part: | ||
import LOGGING_SERVER_URL from 'somewhere'; | ||
import initErrorTransformer from './src/errorTransformer'; | ||
import initErrorTransformer from 'talend-log'; | ||
@@ -97,3 +97,3 @@ const logger = createLogger({ | ||
import LOGGING_SERVER_URL from 'somewhere'; | ||
import initErrorTransformer from './src/errorTransformer'; | ||
import initErrorTransformer from 'talend-log'; | ||
import transportConfig from 'somewhere'; | ||
@@ -108,2 +108,4 @@ | ||
import { TraceKit } from 'talend-log'; | ||
fetch('google.com').catch(errorResponse => TraceKit.report(new Error(errorResponse))); | ||
@@ -110,0 +112,0 @@ |
@@ -5,5 +5,6 @@ /** | ||
* @exports redux-logger compatible error logging middleware | ||
* @export TraceKit, to avoid adding dependency to customer's code | ||
**/ | ||
import TraceKit from 'tracekit'; | ||
import TraceKit_ from 'tracekit'; | ||
import 'whatwg-fetch'; | ||
@@ -25,3 +26,3 @@ | ||
try { | ||
TraceKit.report(ex); | ||
TraceKit_.report(ex); | ||
} catch (e) { | ||
@@ -31,5 +32,5 @@ rethrowErrorHandler(ex); | ||
} | ||
report.subscribe = TraceKit.report.subscribe; | ||
report.unsubscribe = TraceKit.report.unsubscribe; | ||
TraceKit.fallback = TraceKit.report; | ||
report.subscribe = TraceKit_.report.subscribe; | ||
report.unsubscribe = TraceKit_.report.unsubscribe; | ||
TraceKit_.fallback = TraceKit_.report; | ||
return report; | ||
@@ -79,3 +80,3 @@ } | ||
Error.stackTraceLimit = stackTraceLimit; | ||
Object.assign(TraceKit, { | ||
Object.assign(TraceKit_, { | ||
fetchContext: !!linesOfContext, | ||
@@ -87,3 +88,3 @@ linesOfContext, | ||
if (rethrowErrorHandler) { | ||
TraceKit.report = safeWrapReport(rethrowErrorHandler); | ||
TraceKit_.report = safeWrapReport(rethrowErrorHandler); | ||
} | ||
@@ -95,5 +96,7 @@ | ||
TraceKit.report.subscribe(listener); | ||
TraceKit_.report.subscribe(listener); | ||
return listener; | ||
} | ||
export const TraceKit = TraceKit_; |
@@ -1,5 +0,3 @@ | ||
import TraceKit from 'tracekit'; | ||
import et, { TraceKit } from './errorTransformer'; | ||
import et from './errorTransformer'; | ||
const someString = 'hello'; | ||
@@ -52,3 +50,3 @@ const rethrowErrorHandler = () => {}; | ||
it('should patch TraceKit so it calls rethrowErrorHandler internally', () => { | ||
it('should patch TraceKit_ so it calls rethrowErrorHandler internally', () => { | ||
// given: | ||
@@ -55,0 +53,0 @@ const report = (error) => { |
Sorry, the diff of this file is not supported yet
125417
15
490
112
3