ud-annotatrix icon indicating copy to clipboard operation
ud-annotatrix copied to clipboard

Update of server-side logging system

Open yaskevich opened this issue 5 years ago • 3 comments

Since the application is quite complex, the logging system should go further than console.log that puts everything to server console, and morgan with default setup for HTTP.

Features which could be of use:

  • different logging for development and production mode
  • writing logs to file (for further debugging purposes)
  • more verbose logging to file, when minimizing output to console
  • levels of logging (info, debug, error)
  • unification of logging of both HTTP-requests and other app events
  • customization of HTTP logs (e.g. marking AJAX-requests)
  • ability to migrate to new logging system via bulk replace in the app code (interface similar to one of console.log)

yaskevich avatar Jul 29 '19 18:07 yaskevich

Adding modules of pino logging framework.

Initial setup: https://github.com/yaskevich/ud-annotatrix/commit/e12534e55b73c0a1782414ad2d42a68db121c3f2

Further extension (WIP – HTTP-requests tracking, Express.js middleware): https://github.com/yaskevich/ud-annotatrix/commit/ab1a836240e5e74a0edda889a59b42bedc257a4d

Module pino-multi-stream requires changes for proper display of logs in server console (human readable format), I proposed a pull request to the authors: https://github.com/pinojs/pino-multi-stream/pull/28

yaskevich avatar Jul 29 '19 19:07 yaskevich

All logging on server side is done via new logger https://github.com/yaskevich/ud-annotatrix/commit/d50351b383914739d177a429be82da0a946acaa3 – except logging of HTTP-requests which is WIP.

yaskevich avatar Aug 05 '19 23:08 yaskevich

Removed morgan as being redundant now, custom middleware does its job. Added forwarded-for to access user's IP address when the application runs behind a proxy. Via commit https://github.com/yaskevich/ud-annotatrix/commit/e395d581228d54ac5235553eb12f1137178dd65e

yaskevich avatar Aug 18 '19 11:08 yaskevich