NuGet npm Samples

Logging to from SvelteKit

To log all errors from a SvelteKit application, install the npm package as described in Logging from JavaScript. Then add the following code to the hooks.client.js file. If the file does not exist, make sure to create it in the src folder since SvelteKit will automatically load it from there.

import Elmahio from '';
var logger = new Elmahio({
    apiKey: 'API_KEY',
    logId: 'LOG_ID'

/** @type {import('@sveltejs/kit').HandleClientError} */
export function handleError({ error, event }) {
    if (error && error.message) {
        logger.error(error.message, error);
    } else {
        logger.error('Error in application', error);

When launching your SvelteKit app, is configured and all errors happening in the application are logged. For now, only supports SvelteKit apps running inside the browser, why implementing the HandleServerError is not supported.

Check out the elmahio-sveltekit 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