mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-15 20:13:50 +00:00
refactor(#92): Move site-name into env var
This commit is contained in:
@@ -14,3 +14,5 @@ VITE_BREVO_SENDER_EMAIL="noreply@example.com"
|
|||||||
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"
|
||||||
@@ -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(),
|
||||||
|
|||||||
Reference in New Issue
Block a user