NuGet npm Samples

Logging to from Vue

To log all errors from a Vue.js application, install the npm package as described in Logging from JavaScript or include it with a direct <script> include:

<script src="[email protected]/dist/elmahio.min.js" type="text/javascript"></script>

Before initializing the application, include the following code:

var logger = new Elmahio({
  apiKey: "API_KEY",
  logId: "LOG_ID"
Vue.config.errorHandler = function (err, vm, info) {
  logger.error(err.message, err);
Vue.config.warnHandler = function (msg, vm, trace) {
}; will automatically log all errors raised through window.onerrorand log additional errors and warnings from Vue.js through the errorHandler and warnHandler functions. If you want to exclude warnings, simply remove the warnHandler function.

Check out the Elmah.Io.JavaScript.VueJs sample for some real working code.

This article was brought to you by the team. is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website