framework/log.py: Merge Log.log() and Log.post_log()

These methods were always called back to back, and required an
overlapping set of arguments. Initially I thought that having a second
method might be useful, but it doesn't really seem that useful at this
point.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
framework/log.py: Use keyword args to format instead of splat

Using splat with a dictionary makes sense when the dictionary is already
available (like with locals()), but it isn't very clear.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
log.py: Makes method names clearer

This replace _summary, _running, and _percent with _format*. This makes
the methods easier to understand, especially with names like __summary
also used in the class

v2: - rename _print_* to _format_* (Ilia)

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
framework: refactor the log module

This refactors the log module away from a single class that does
everything to having two classes. The first class LogFactory, is a state
manager that returns BaseLog derived objects when it's get() method is
called. However, it mainly acts as a shared state manager.

The BaseLog derived classes provide three public methods; start(),
log(), summary().

This makes the interfaces much cleaner, just 3 public methods that are
fairly obvious and clearly documented. It uses inheritance for more
shared code, and is just generally much less complex than the previous
implementation

The use of a non-recursive lock mandates that the majority of the code
be in un-locked protected methods, while the public method takes the
lock, otherwise inheritance is nearly impossible.

v2: - Fix summary line in the verbose logger to support using '\r'. This
      works by printing the summary at the end of start() and log()
    - add -v/--verbose option back (Ilia)
v3: - Be more aggressive about locking
v4: - be more granular with locking by using two locks, one for
      printing, one for manipulating the shared data.
    - Move some unit tests to the next patch that belong there.
v5: - simplify the locking. This may have a performance impact, but
      makes the code much simpler. It should be possible to make the
      locking finer grained later
v6: - Lock one additional command
v7: - fix bug in Test. Test did not call log.start() so verbose log
      would print <status>: None
    - replace RLock with Lock. This requires a little bit of refactoring
      to make it work, since the lock cannot be called recursively
v8: - remove trailing whitespace

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
framework: Add dummy logger that produces no output

This adds a new logger option that produces no output. This is aimed at
headless setups or for systems like jenkins where the output data isn't
very useful.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>