Commit 42999a1f authored by Valentin Reis's avatar Valentin Reis

Log files in place, except power log.

parent 06e6fb70
Pipeline #4559 failed with stages
in 2 minutes and 10 seconds
......@@ -26,6 +26,8 @@ def main(argv=None):
defaults = { "log":"/tmp/argo_daemon.log"
, "log_power":"/tmp/argo_daemon_power.log"
, "log_progress":"/tmp/argo_daemon_progress.log"
, "log_hardwareprogress":"/tmp/argo_daemon_hardwareprogress.log"
, "powerstrategy":"0" }
if args.print_defaults:
......@@ -39,6 +41,8 @@ def main(argv=None):
parser.set_defaults(**defaults)
parser.add_argument("--log", help="Main log file.",metavar="FILE")
parser.add_argument("--log_power", help="Power data log file (High throughput).",metavar="FILE")
parser.add_argument("--log_progress",metavar="FILE")
parser.add_argument("--log_hardwareprogress",metavar="FILE")
parser.add_argument("--powerstrategy", help="Power management strategy.",metavar="STRATEGY")
args = parser.parse_args(remaining_argv)
nrm.daemon.runner(config=args)
......
{
"log":"/tmp/daemon_log.log"
"log_power":"/tmp/daemon_power.log"
"log_progress":"/tmp/daemon_progress.log"
"log_hardwareprogress":"/tmp/daemon_hardwareprogress.log"
}
from __future__ import print_function
import logging
import time
logger = logging.getLogger('nrm')
logger_progress = logging.getLogger('progress')
logger_hardwareprogress = logging.getLogger('hardwareprogress')
class Application(object):
......@@ -29,10 +31,12 @@ class Application(object):
"""Update the progress tracking."""
assert self.progress
logger.info("received progress message: "+str(msg))
logger_progress.info("%s %s" % (time.time(),msg['payload']))
def update_hardwareprogress(self, msg):
"""Update the progress tracking."""
logger.info("received progress message: "+str(msg))
logger_hardwareprogress.info("%s %s" % (time.time(),msg['payload']))
if not self.hardwareprogress:
logger.debug("Starting to log hardware progress.")
self.hardwareprogress = True
......
......@@ -333,8 +333,26 @@ def runner(config):
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.FileHandler(config.log))
if config.log_progress:
print("Logging progress data to %s" % config.log_progress)
logger_progress = logging.getLogger('progress')
logger_progress.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(message)s')
handler = logging.FileHandler(config.log_progress)
handler.setFormatter(formatter)
logger_progress.addHandler(handler)
if config.log_hardwareprogress:
print("Logging progress data to %s" % config.log_hardwareprogress)
logger_hardwareprogress = logging.getLogger('hardwareprogress')
logger_hardwareprogress.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(message)s')
handler = logging.FileHandler(config.log_hardwareprogress)
handler.setFormatter(formatter)
logger_hardwareprogress.addHandler(handler)
if config.log_power:
print("Logging power data to %s" % config.log_power)
print("Logging progress data to %s" % config.log_power)
logger_power = logging.getLogger('power')
logger_power.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(message)s')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment