I am using the NestJS starter from their documentation here.
- NestJS 7.6.15.
- Node Version 12.20.1
- Windows 10 Pro (OS Build 19042.867)
I did not change anything in the main.ts to change the logger functionality.
main.ts:
import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); await app.listen(3000); } bootstrap();
None of my loggers are printing anything at all. Example:
import { Injectable, Logger } from '@nestjs/common'; import { Cron, CronExpression } from '@nestjs/schedule'; @Injectable() export class ScheduledTask { private readonly logger = new Logger(ScheduledTask.name); @Cron(CronExpression.EVERY_5_SECONDS) handleCron() { this.logger.log('This does not print.'); } }
package.json
{ "name": "nest-typescript-starter", "private": true, "version": "1.0.0", "description": "Nest TypeScript starter repository", "license": "MIT", "scripts": { "prebuild": "rimraf dist", "build": "nest build", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "nest start", "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json" }, "dependencies": { "@nestjs/common": "^7.6.15", "@nestjs/core": "^7.6.15", "@nestjs/mapped-types": "*", "@nestjs/platform-express": "^7.6.15", "@nestjs/schedule": "^0.4.3", "@nestjs/typeorm": "^7.1.5", "mysql2": "^2.2.5", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^6.6.6", "typeorm": "^0.2.31" }, "devDependencies": { "@nestjs/cli": "^7.6.0", "@nestjs/schematics": "^7.3.1", "@nestjs/testing": "^7.6.15", "@types/cron": "^1.7.2", "@types/express": "^4.17.11", "@types/jest": "^26.0.22", "@types/node": "^14.14.36", "@types/supertest": "^2.0.10", "@typescript-eslint/eslint-plugin": "^4.19.0", "@typescript-eslint/parser": "^4.19.0", "eslint": "^7.22.0", "eslint-config-prettier": "^8.1.0", "eslint-plugin-prettier": "^3.3.1", "jest": "^26.6.3", "prettier": "^2.2.1", "supertest": "^6.1.3", "ts-jest": "^26.5.4", "ts-loader": "^8.0.18", "ts-node": "^9.1.1", "tsconfig-paths": "^3.9.0", "typescript": "^4.2.3" }, "jest": { "moduleFileExtensions": [ "js", "json", "ts" ], "rootDir": "src", "testRegex": ".*\\.spec\\.ts$", "transform": { "^.+\\.(t|j)s$": "ts-jest" }, "collectCoverageFrom": [ "**/*.(t|j)s" ], "coverageDirectory": "../coverage", "testEnvironment": "node" } }
Any ideas?
https://stackoverflow.com/questions/66847909/nestjs-logger-doesnt-print-on-windows March 29, 2021 at 10:02AM
没有评论:
发表评论