Logging and importance of it with examples
Python and Flask supports wide range of logging as well. Either it’s warning, error or just a logger you can ago through all of those in very specific instance of time.
Logging is important of the Maintainability of the application.
Now logging is something like you need to go for when you see or feel that your web app needs lots of “Watching as well!”
Here is simple Example in Flask:
from logging.handlers import RotatingFileHandler
from flask import Flask
app = Flask(__name__)
app.logger.warning('A warning occurred (%d apples)', 42)
app.logger.error('An error occurred')
if __name__ == '__main__':
handler = RotatingFileHandler('foo.log', maxBytes=10000, backupCount=1)
for more detailed view on logging and system you can go for the following link as well. :
It’s very much explanatory: https://gist.github.com/mariocj89/73824162a3e35d50db8e758a42e39aab