green-fox-academy / hotel-booking-user-service

0 stars 0 forks source link

Logging #5

Open EggDice opened 7 years ago

EggDice commented 7 years ago

Logging

Create a simple unit that is able to log any message to the standard out. The application should have 4 different log levels, in the following increasing priority:

debug: Logging any debugging related information, that is only informative for the current temporary debugging situation. Typically not logged in production environment. info: Generally useful information to log (service start/stop, configuration assumptions, etc). Info I want to always have available but usually don't care about under normal circumstances. This is my out-of-the-box config level. warn: Anything that can potentially cause application oddities, but for which I am automatically recovering. (Such as switching from a primary to backup server, retrying an operation, missing secondary data, etc.) error: Any error which is fatal to the operation, but not the service or application (can't open a required file, missing data, etc.). These errors will force user (administrator, or direct user) intervention. These are usually reserved (in my apps) for incorrect connection strings, missing services, etc. Technical Requirements

The unit should have a method for each log level and it should take the log message as a prameter. It should print the level, the hostname, and the message. in a format like:

INFO some-service.herokuapp.com message The debug and info levels should log to the standard out and the warn and error levels should log to the standard error.

EggDice commented 7 years ago

Estimation: 5