Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
625 views
in Technique[技术] by (71.8m points)

How to use Winston Logger in NestJS separate module that doesn't use Classes

I've tried a few different ways of doing this.

I can't set Winston as the default logger for NestJS at the moment because it complains about "getTimestamp" function not being in the instance.

So - for controllers in NestJS - I have used dependency injection - which works fine for the api ( REST endpoints ).

The problem is that I have moved away from OOP - so all of my libraries are written in typescript as functions. Not pure functions but better than an OOP approach ( many less bugs! )

My question is - how do I get access to the main winston logger within my libraries that don't have classes.

I am using the library nest-winston.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...