Replies: 2 comments 2 replies
-
|
Hi in this moment we don't have an integration done for frontend frameworks or libraries (we are working on it starting with angular and sveltekit) Right now, we're using our own SDK for backend logging (Node.js/Fastify side) and we log client-side errors manually. Here's the pattern we follow: Server-side (SvelteKit hooks)// src/hooks.server.ts
import { logtide } from '$lib/server/logtide';
export const handleError = async ({ error, event }) => {
// Log to Logtide
logtide.error('SvelteKit error', {
error: error.message,
stack: error.stack,
path: event.url.pathname,
method: event.request.method,
userId: event.locals.user?.id
});
return {
message: 'An error occurred'
};
};Client-side error boundary// src/hooks.client.ts
export const handleError = async ({ error, event }) => {
// Send to your Logtide endpoint
await fetch('/api/log-error', {
method: 'POST',
body: JSON.stringify({
message: error.message,
stack: error.stack,
url: window.location.href
})
});
};As said I'm actually working on a dedicated SvelteKit integration that will make this much smoother. It would include:
In the meantime, the manual approach above works well for us in production. Let me know if you need help setting it up! |
Beta Was this translation helpful? Give feedback.
-
|
We have released a package for sveltekit: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Especially since you are using Sveltekit youself - is there an example of how to use Sveltekit with logtide?
In particular the observability and error capture.
Beta Was this translation helpful? Give feedback.
All reactions