From bee6ae73b89a19a2ee7ba6201262935225dca6b8 Mon Sep 17 00:00:00 2001 From: Matan Mashraki <12946462+planecore@users.noreply.github.com> Date: Sun, 10 Dec 2023 23:39:18 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20-=20Added=20db=20name=20to=20log?= =?UTF-8?q?s=20(#21)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/config.ts | 1 + src/logs/logger.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/data/config.ts b/src/data/config.ts index 93223ac..a840727 100644 --- a/src/data/config.ts +++ b/src/data/config.ts @@ -15,3 +15,4 @@ export const appleKeyId = process.env.APPLE_KEY_ID as string export const appleKeyContent = (process.env.APPLE_KEY_CONTENT as string)?.replace(/\\n/g, "\n") export const appleApnHost = process.env.APN_ENV === "production" ? Host.production : Host.development export const firebaseAdminAuth = JSON.parse(process.env.FIREBASE_ADMIN_AUTH || "{}") +export const railwayEnviroment = process.env.RAILWAY_ENVIRONMENT_NAME || "dev" diff --git a/src/logs/logger.ts b/src/logs/logger.ts index 4249842..8fa394e 100644 --- a/src/logs/logger.ts +++ b/src/logs/logger.ts @@ -2,7 +2,7 @@ import { isEmpty } from "lodash" import winston from "winston" import "winston-mongodb" -import { mongoUrl } from "../data/config" +import { mongoUrl, railwayEnviroment } from "../data/config" export let logger: winston.Logger @@ -30,7 +30,7 @@ export const startLogger = () => { new winston.transports.Console(), new winston.transports.MongoDB({ db: mongoUrl, - dbName: "logs", + dbName: "logs" + (railwayEnviroment === "production" ? "" : `-${railwayEnviroment}`), format: serializeErrors(), }), ],