Your task is to implement logging functionality to the already existing REST service.
- Only
@nestjs/common
and@nestjs-core
Nest.js modules can be used for the logger and error handling feature assignment, other Nest.js modules are prohibited - Use 22.x.x version (22.9.0 or upper) of Node.js
- Implement custom
LoggingService
which will be used for logging and provided viadependency injection
- Incoming requests to service (at least
url
,query parameters
,body
) and response withstatus code
should be logged byLoggingService
. - Implement custom
Exception Filter
and use it for handling errors during request processing. In case of unexpected error response with HTTP code500
(Internal Server Error) and standard message should be sent LoggingService
should log allerrors
- Add listener and logging to
uncaughtException
event - Add listener and logging to
unhandledRejection
event - Writing to
process.stdout
or to a file both can be used for logging - There should be multiple logging levels and logging level should be stored in environment variable
- Log file rotation should be setup with file size (kB) parameter.