[autotest] Add placeholder job_reporter
BUG=chromium:748234
TEST=Unit tests
Change-Id: Iead4ddd298cf6dea512687fa3239ab3f620aa854
Reviewed-on: https://chromium-review.googlesource.com/580670
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/venv/lucifer/loglib.py b/venv/lucifer/loglib.py
new file mode 100644
index 0000000..1f06878
--- /dev/null
+++ b/venv/lucifer/loglib.py
@@ -0,0 +1,65 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""lucifer scripts shared logging related functions."""
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
+import logging
+import logging.config
+
+
+def add_logging_options(parser):
+ """Add logging configuration options to argument parser.
+
+ @param parser: ArgumentParser instance.
+ """
+ # Unused for the moment, but will be useful when we need to add
+ # logging options.
+ del parser
+
+
+def configure_logging_with_args(parser, args):
+ """Convenience function for calling configure_logging().
+
+ @param parser: ArgumentParser instance.
+ @param args: Return value from ArgumentParser.parse_args().
+ """
+ # Unused for the moment, but will be useful when we need to add
+ # logging options.
+ del args
+ configure_logging(name=parser.prog)
+
+
+def configure_logging(name):
+ """Configure logging globally.
+
+ @param name: Name to prepend to log messages.
+ This should be the name of the program.
+ """
+ logging.config.dictConfig({
+ 'version': 1,
+ 'formatters': {
+ 'stderr': {
+ 'format': ('{name}: '
+ '%(asctime)s:%(levelname)s'
+ ':%(module)s:%(funcName)s:%(lineno)d'
+ ':%(message)s'
+ .format(name=name)),
+ },
+ },
+ 'handlers': {
+ 'stderr': {
+ 'class': 'logging.StreamHandler',
+ 'formatter': 'stderr' ,
+ }
+ },
+ 'root': {
+ 'level': 'DEBUG',
+ 'handlers': ['stderr'],
+ },
+ 'disable_existing_loggers': False,
+ })