-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
🔎 Search Terms
mongodb-winston,typescript
The problem
"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"
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
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);Additional information
No response
Metadata
Metadata
Assignees
Labels
No labels