Skip to content

Commit

Permalink
🔧 - Added db name to logs (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
planecore authored Dec 10, 2023
1 parent 6e92830 commit bee6ae7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions src/logs/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(),
}),
],
Expand Down

0 comments on commit bee6ae7

Please sign in to comment.