refactor(#92): Move site-name into env var

This commit is contained in:
Josh Creek
2024-11-12 21:21:47 +00:00
parent 62f7525238
commit 61194d7132
2 changed files with 9 additions and 3 deletions
+3 -1
View File
@@ -13,4 +13,6 @@ VITE_BREVO_SENDER_EMAIL="noreply@example.com"
# Display name for the sender email # Display name for the sender email
VITE_BREVO_SENDER_NAME="No Reply" VITE_BREVO_SENDER_NAME="No Reply"
# Contact email for the contact page form to send to # Contact email for the contact page form to send to
VITE_CONTACT_EMAIL="" VITE_CONTACT_EMAIL=""
# Logger service name to identify this website
VITE_LOGGER_SERVICE_NAME="example-site"
+6 -2
View File
@@ -1,6 +1,10 @@
import { createLogger, transports, format } from 'winston'; import { createLogger, transports, format } from 'winston';
import { WinstonTransport as AxiomTransport } from '@axiomhq/winston'; import { WinstonTransport as AxiomTransport } from '@axiomhq/winston';
import { VITE_AXIOM_DATASET, VITE_AXIOM_TOKEN } from '$env/static/private'; import {
VITE_AXIOM_DATASET,
VITE_AXIOM_TOKEN,
VITE_LOGGER_SERVICE_NAME
} from '$env/static/private';
const axiomTransport = new AxiomTransport({ const axiomTransport = new AxiomTransport({
dataset: VITE_AXIOM_DATASET, dataset: VITE_AXIOM_DATASET,
@@ -9,7 +13,7 @@ const axiomTransport = new AxiomTransport({
const logger = createLogger({ const logger = createLogger({
level: 'info', level: 'info',
defaultMeta: { service: 'example-site' }, // Change this so you can identify your website if you have multiple logging into Axiom defaultMeta: { service: VITE_LOGGER_SERVICE_NAME }, // Change this so you can identify your website if you have multiple logging into Axiom
format: format.combine( format: format.combine(
format.errors({ stack: true }), // Captures error stack traces format.errors({ stack: true }), // Captures error stack traces
format.timestamp(), format.timestamp(),