logging and trouble shooting - samuelchen/gagein-web-new GitHub Wiki

We are leverage winston logging component.

Logging level

We have 5 logging levels:

  • debug - The debug message. Used to tracking detail runtime information. Often used for trouble shooting. The message amount is large.
  • info - The general information. Used to log the system running status. Generally it logs entering/exiting a module/function, key data, a request or etc.
  • warn - Something need to be noticed. Warning message is logged when an expected issue occurs and well handled. But the issue should not occur.
  • error - Represents an error occurs. Logged when an exception throw or some critical issue occurs. This kind of issue may not stop the system. But it makes an incorrect/unexpected result.
  • fatal - Means the system fault. This type of message will be logged when a system error occurs. This error stops the system or makes system incorrect.

Logging target

We have different way to keep the logs:

  • console - Display on system console. General it is used when developing.
  • file - Common way to keep logs. But distributed on different app service.
  • stream - May collected logs from all app server to a log server.
  • DB / NoSQL - May write logs to a DB. We may write some key logs to it.

Category

Winston provides the feature to obtain a logger category. It performs as a logger but it's a part of this logger. We could use it to identify different log type.

Un-handled error

winston provide the capability to log an un-handled exception. We just config it as well.

Rotation