Closed orderamidchaos closed 10 years ago
There is not, but you can add this fairly easily yourself with the plugin API: https://github.com/pimterry/loglevel#plugins. For the reasons described in there, I don't want to add this to loglevel directly.
Assuming that by sending to a variable you mean calling another function with it, you could do this yourself with something like:
// Your code:
var errorMessageListener = function (message) {
// do something with the message
};
// Plugin:
var originalFactory = log.methodFactory;
log.methodFactory = function (methodName, logLevel) {
var rawMethod = originalFactory(methodName, logLevel);
return function (message) {
errorMessageListener(message);
rawMethod(message);
};
};
Is there any way to send the error message simultaneously to a variable for generating a bug report?