I am trying to save my nestjs application logs to azure blob storage using the winston library, I tried to create a custom transport like this:
import { StorageService } from "/server/storage";
import { Injectable } from '@nestjs/common';
import Transport from 'winston-transport';
export class AzureTransport extends Transport {
storageService:StorageService;
constructor(options: any) {
super(options);
this.storageService=options.storageService;
}
log(info: any, callback: () => void) {
try {
this.storageService.writeStreamToFile("../logs", info);
callback();
} catch(e) {
console.error(e);
}
}
}
But I got this error: "...can only be default-imported using the 'esModuleInterop' flag". I set the flag to true in my tsconfig file, but still does not work. Could anyone tell me how to create a custom transport in nestjs for winston?
I set the flag to true in my tsconfig file, but still does not work. Could anyone tell me how to create a custom transport in nestjs for winston?