Revert "Reland "Split lab inventory logs up by time of run""

This reverts commit ef6c92ea681a15934699dfa043fa0337a575be9b.

Reason for revert: breaks lab_inventory runs. Again.

BUG=chromium:888577
TEST=unittest

Original change's description:
> Reland "Split lab inventory logs up by time of run"
>
> For easier debugging
>
> BUG=chromium:872816, chromium:881621
> TEST=Needs more testing
>
> Change-Id: Ic78ecbb398e3e8615b3106496d93f196801a64fb
> Reviewed-on: https://chromium-review.googlesource.com/1213771
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Jacob Kopczynski <jkop@chromium.org>
> Reviewed-by: Richard Barnette <jrbarnette@google.com>

Bug: chromium:872816, chromium:881621
Change-Id: Ice6974dacfdb1c7174b5da63faec23f50cfeb902
Reviewed-on: https://chromium-review.googlesource.com/1242373
Reviewed-by: Alex Zamorzaev <zamorzaev@chromium.org>
Commit-Queue: Alex Zamorzaev <zamorzaev@chromium.org>
Tested-by: Alex Zamorzaev <zamorzaev@chromium.org>
Trybot-Ready: Alex Zamorzaev <zamorzaev@chromium.org>
diff --git a/site_utils/lab_inventory.py b/site_utils/lab_inventory.py
index bbb8553..9148744 100755
--- a/site_utils/lab_inventory.py
+++ b/site_utils/lab_inventory.py
@@ -51,7 +51,6 @@
 
 import argparse
 import collections
-import datetime
 import logging
 import logging.handlers
 import os
@@ -134,13 +133,10 @@
     _METRICS_PREFIX + '/missing', 'DUTs which cannot be found by lookup queries'
     ' because they are invalid or deleted')
 
-_TIMESTAMP_FORMAT = '%Y-%m-%d.%H'
-
 # _Diagnosis - namedtuple corresponding to the return value from
 # `HostHistory.last_diagnosis()`
 _Diagnosis = collections.namedtuple('_Diagnosis', ['status', 'task'])
 
-
 def _get_diagnosis(history):
     dut_present = True
     try:
@@ -1133,7 +1129,7 @@
     @returns  A timestamp string that will be used to identify this run
               in logs and email output.
     """
-    timestamp = time.strftime(_TIMESTAMP_FORMAT,
+    timestamp = time.strftime('%Y-%m-%d.%H',
                               time.localtime(startup_time))
     logging.debug('Starting lab inventory for %s', timestamp)
     if arguments.model_notify:
@@ -1321,19 +1317,18 @@
     root_logger = logging.getLogger()
     if arguments.debug:
         root_logger.setLevel(logging.INFO)
-        logfile = sys.stdout
+        handler = logging.StreamHandler(sys.stdout)
+        handler.setFormatter(logging.Formatter())
     else:
-        root_logger.setLevel(logging.DEBUG)
-        logfile = open(os.path.join(
-            arguments.logdir,
-            _LOGFILE + datetime.datetime.today().strftime(_TIMESTAMP_FORMAT)
-        ))
         if not os.path.exists(arguments.logdir):
             os.mkdir(arguments.logdir)
-    handler = logging.StreamHandler(logfile)
-    formatter = logging.Formatter(
-        _LOG_FORMAT, time_utils.TIME_FMT)
-    handler.setFormatter(formatter)
+        root_logger.setLevel(logging.DEBUG)
+        logfile = os.path.join(arguments.logdir, _LOGFILE)
+        handler = logging.handlers.TimedRotatingFileHandler(
+                logfile, when='W4', backupCount=13)
+        formatter = logging.Formatter(_LOG_FORMAT,
+                                      time_utils.TIME_FMT)
+        handler.setFormatter(formatter)
     # TODO(jrbarnette) This is gross.  Importing client.bin.utils
     # implicitly imported logging_config, which calls
     # logging.basicConfig() *at module level*.  That gives us an