log: refactor logging for max awesomeness
Implement native logger and formater extending standard logging module's classes with extra log levels and use logging.getLogger() method to get logger in individual modules in order to streamline entire logging and remove element of surprise.
pkg.log wrappers were confusing certain tools and resulting in tracebacks leading to log.py module as opposed to the file where the error was really logged.
This is the most pythonic way of doing things using the standard logging module I found and it allows users more control over logging using standard interface and it should be transparent for other tools such as py.test as well.
Coloring is now done in a more efficient manner (on-demand with cache) on log formatter level and it can produce different log formats based on message log level as well as current global log level. This is all done on the log formatting side so the messages themselves are stored in plain text without any noise.
New apkg.log.set_log_level() can be used to set global log level for apkg.log and regenerate formatting strings accordingly.
CLI logging was improved using new features:
- --quiet: only show warn, error, and success messages
- --verbose: show python module and function name (color coded)
- --debug: show full path to python script, line number and function name (color coded)
This refactoring should make it much easier to debug apkg and parse its output in many different scenarios.