Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
talend-log
Advanced tools
Small wrapper over TraceKit, that allows to inject error reporting as redux-logger middleware
A small library that provides redux-logger middleware for error logging to be applied as errorTransformer.
Exports redux-logger compatible error logging middleware.
your configStore.js file:
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import promise from 'redux-promise-middleware';
import createLogger from 'redux-logger';
import LOGGING_SERVER_URL from 'somewhere';
import initErrorTransformer, { TraceKit } from 'talend-log';
// important part:
const logger = createLogger({ errorTransformer: initErrorTransformer(LOGGING_SERVER_URL) });
// :end of important part
const createStoreWithMiddleware = applyMiddleware(thunkMiddleware, promise(), logger)(createStore);
export default function configureStore(reducer, initialState) {
const store = createStoreWithMiddleware(reducer, initialState);
// drop a reference to store instance for later use in errorLogging reportMiddleware
TraceKit.store = store;
return store;
}
Look in ./src/errorTransformer.js for jsDoc on each parameter
import LOGGING_SERVER_URL from 'somewhere';
import initErrorTransformer from 'talend-log';
const logger = createLogger({
errorTransformer: initErrorTransformer(
LOGGING_SERVER_URL, {
send: (payload, fetchOptions) => fetch(LOGGING_SERVER_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'@message': payload
}),
...fetchOptions,
}),
payloadMiddleware: payload => Object.assign({
state: TraceKit.store.getState()
}, payload),
fetchOptions: {
headers: {
'Content-Type': 'application/json',
custom: 'customData'
}
},
successHandler: (responseText) => {
alert('yay! ' + responseText)
},
retryCount: 5,
retryTimeout: 3000,
failedTryHandler: function failedTry(error, payload, transportOpts, attempt) {
alert('Oh no! ' + error);
transportOpts.send(transportOpts.payloadMiddleware(payload), transportOpts.fetchOptions, attempt + 1);
},
failedReportHandler: (errorResponse) => {
alert('oh no! ' + errorResponse)
},
}, {
stackTraceLimit: 100,
linesOfContext: 13,
rethrowErrorHandler: () => {},
remoteFetching: true,
collectWindowErrors: true,
}
)
});
Notable details:
If you have some non-critical exceptions that should be reported, but should not break application, then use a possibility to provide handler for better microcontrol:
in your config file:
import LOGGING_SERVER_URL from 'somewhere';
import initErrorTransformer from 'talend-log';
import transportConfig from 'somewhere';
// this:
initErrorTransformer(LOGGING_SERVER_URL, transportConfig, {
rethrowErrorHandler: (e) => { if (e.type === 'critical') { throw e; } else { console.error(e); } },
})
somewhere in your application:
import { TraceKit } from 'talend-log';
fetch('google.com').catch(errorResponse => TraceKit.report(new Error(errorResponse)));
TraceKit - Cross browser stack traces. https://github.com/csnover/TraceKit
FAQs
Small wrapper over TraceKit, that allows to inject error reporting as redux-logger middleware
The npm package talend-log receives a total of 88 weekly downloads. As such, talend-log popularity was classified as not popular.
We found that talend-log demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.