Skip to content

How to add custom field? #217

@vickyRathee

Description

@vickyRathee

I'd like to add custom field in logs collection, but it's not written in DB. Any suggestion?

const metaFormat = winston.format((info) => {
  return { ...info, app: 'test' };
});

const transports  = [
              new winston.transports.MongoDB({
                db: process.env.MONGODB_CONNECTION,
                options: {
                  useUnifiedTopology: true,
                },
                collection: 'logs',
                format: winston.format.combine(
                  metaFormat(),
                  winston.format.json(),
                ),
              }),
            ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions