Open nixrajput opened 10 months ago
mongodb-winston,typescript
"winston": "^3.11.0", "winston-daily-rotate-file": "^4.7.1", "winston-mongodb": "^5.1.1"
Getting below error when using with TypeScript:
Cannot find package "mongodb-extjson" from "/home/user/Workspace/nodejs-projects/express-api/node_modules/winston-mongodb/node_modules/mongodb/lib/core/utils.js"
v3.11.0
v20.x
No response
import { MongoDBTransportInstance, MongoDBConnectionOptions, } from "winston-mongodb"; import { createLogger, format, transports } from "winston"; const { MongoDB, }: { MongoDB: MongoDBTransportInstance } = require("winston-mongodb"); const mongoTransport = new MongoDB({ db: LocalConfig.getConfig().MONGO_URI!, dbName: LocalConfig.getConfig().DB_NAME!, storeHost: true, collection: "logs", options: { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true, }, format: format.combine( format.timestamp(), format.json() // errorStackFormat(), // format.printf(({ timestamp, level, message }) => { // return `[${timestamp}] ${level}: ${message}`; // }) ), } as MongoDBConnectionOptions);
🔎 Search Terms
mongodb-winston,typescript
The problem
Getting below error when using with TypeScript:
What version of Winston presents the issue?
v3.11.0
What version of Node are you using?
v20.x
If this worked in a previous version of Winston, which was it?
No response
Minimum Working Example
Additional information
No response