InterviewSolution
| 1. |
Explain Logging in Flask. |
|
Answer» You can find yourself in a position where you're dealing with data that should be correct but isn't. For example, you might have some CLIENT-side code that sends a faulty HTTP request to the server. This could be due to tampering with the data by a user or a bug in the client code. In most cases, RESPONDING with 400 Bad Request is SUFFICIENT, but this isn't always the case, and the code must continue to function. You might still wish to note that something unusual occurred. Loggers COME in handy in this situation. With Flask 0.3, you can utilize a logger that has been preconfigured for you. The following are some examples of log calls: app.logger.debug('A value for debugging')[TEXT Wrapping Break]app.logger.warning('A warning occurred (%d apples)', 42)[Text Wrapping Break]app.logger.error('An error occurred') |
|