Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: testing/legion/common_lib.py

Issue 890773003: Adding the initial code for Omnibot multi-machine support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing initial comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/legion/common_lib.py
diff --git a/testing/legion/common_lib.py b/testing/legion/common_lib.py
new file mode 100644
index 0000000000000000000000000000000000000000..ebaa111b80d5e155a722ba255c6e0c3fd6dc3a6a
--- /dev/null
+++ b/testing/legion/common_lib.py
@@ -0,0 +1,34 @@
+# Copyright 2015 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.
+"""Common library methods.
+
+These methods can be used by both the host and the client code.
+"""
+
+import argparse
+import logging
+import socket
+import sys
+import xmlrpclib
+import SimpleXMLRPCServer
+
+LOGGING_FORMAT = ('%(asctime)s %(filename)s:%(lineno)s %(levelname)s] '
+ '%(message)s')
+LOGGING_DATE_FORMAT = '%H:%M:%S'
+MY_IP = socket.gethostbyname(socket.gethostname())
+
+
+def InitLogging():
+ """Initialize the logging module."""
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--verbose', action='store_true')
+ args, _ = parser.parse_known_args()
+ level = logging.DEBUG if args.verbose else logging.INFO
Marc-Antoine Ruel (Google) 2015/01/30 21:58:40 (FYI) in generally we use ERROR as default.
Mike Meade 2015/02/03 01:18:09 Unfortunately setting logging to error results in
M-A Ruel 2015/02/03 01:48:40 Ah! I can fix that later in the client code. It's
+ logging.basicConfig(format=LOGGING_FORMAT, datefmt=LOGGING_DATE_FORMAT,
+ level=level)
+
+
+def LogCommandLine():
+ """Log the command line used to run this program."""
+ logging.debug(' '.join(sys.argv))

Powered by Google App Engine
This is Rietveld 408576698