Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
update request logging
Browse files Browse the repository at this point in the history
  • Loading branch information
CelestialCrafter committed Dec 12, 2023
1 parent 45fbddb commit 01c5ada
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/lib/logging.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,24 @@ const transactionSerializer = transaction => {

const svelteRequestEventSerializer = event => {
if (!event?.request) return event;
const eventCopy = { ...event };

const headers = Object.fromEntries(event.request.headers);
delete headers.cookie;
delete eventCopy.request.platform;

let address = 'unknown';

try {
address = eventCopy.getClientAddress();
} catch (err) {}

return {
method: event.request.method,
url: event.url,
method: eventCopy.request.method,
url: eventCopy.url,
headers,
remoteAddress: event.getClientAddress(),
platform: event.platform,
remoteAddress: address,
platform: eventCopy.platform,
id: crypto.randomUUID()
};
};
Expand Down

0 comments on commit 01c5ada

Please sign in to comment.