Reputation: 3320
Currently I have the following code:
import { Injectable, Logger } from '@nestjs/common';
@Injectable()
export class CategoriesService {
logger: Logger;
constructor(@InjectModel(Categories.name) private categoriesModel: Model<CategoriesDocument>) {
this.logger = new Logger();
}
...
In a method I then attempt to log:
getCategories({ text, first, page, hasType, parent }: GetCategoriesArgs) {
this.logger.log('getCategories is triggered');
...
I don't get an error but I don't see the log message in terminal window. Any ideas what I'm missing? Also console.log() also doesn't appear.
Upvotes: 2
Views: 1880
Reputation: 1193
I had the same issue - strangely, it appeared to be a cacheing issue. In my case I had to:
/dist
folder andnpm run start:dev
Both console.log(...)
and this.logger.log(...)
instance I setup began working.
Upvotes: 1