gremo / nest-winston

A Nest module wrapper form winston logger
MIT License
629 stars 94 forks source link

Using MondoDb as transport #148

Closed adikaladik closed 4 years ago

adikaladik commented 4 years ago

Hi! Can someone please advise how can I use this lib with nest-winston? https://github.com/winstonjs/winston-mongodb

gremo commented 4 years ago

Have you tried requiring winston-mongodb in your module, and than simply passing new winston.transports.MongoDB to the transports array?

For example:

import { Module } from '@nestjs/common';
import { WinstonModule } from 'nest-winston';
import * as winston from 'winston';

require('winston-mongodb');

@Module({
  imports: [
    WinstonModule.forRoot({
      transports: [
        new winston.transports.MongoDB(options),
      ],
      // other options
    }),
  ],
})
export class AppModule {}
adikaladik commented 4 years ago

Yes, tried. Property 'MongoDb' does not exist on type 'Transports'.

gremo commented 4 years ago

Can you please provide a minimal repository/example? I'm trying to understand if this is something related to winston-mognodb or this library.

Because the error is:

Property 'MongoDb' does not exist on type 'Transports'

I think this is something wrong with winston-mongodb typings.

gremo commented 4 years ago

Closing, feel free to comment further if you need any help, or share your solution (if you have one).

kuamatzin commented 1 year ago

@adikaladik dis you find the solution?