diff options
author | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 19:56:46 +0000 |
---|---|---|
committer | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 19:56:46 +0000 |
commit | 3f864c9e42e237796ce4abbd4e6ce0e73dd9d2a1 (patch) | |
tree | 79d43c3d85afb774a0c88937b21f99aac0f78101 /net/tools | |
parent | 9cb5cc705b1df14ac0854dda49f47d055cb57f2d (diff) | |
download | chromium_src-3f864c9e42e237796ce4abbd4e6ce0e73dd9d2a1.zip chromium_src-3f864c9e42e237796ce4abbd4e6ce0e73dd9d2a1.tar.gz chromium_src-3f864c9e42e237796ce4abbd4e6ce0e73dd9d2a1.tar.bz2 |
Silence testserver logs when tests are run in non-verbose mode
The console output from testserver.py, chromiumsync.py and xmppserver.py during sync integration test runs is pretty chatty, and could do with being disabled by default. In addition, testserver.py spits out logs for non-sync tests even when the tests are run in non-verbose mode.
This patch adds a switch to testserver.py called "log-to-console", and ties it up to the logging level returned by logging::GetMinLogLevel(). This way, testserver logs are printed on the console (in addition to being written to testserver.log) when tests are run in verbose mode. However, when tests are run in non-verbose mode, testserver logs are only written to the log file, but not to the console.
BUG=71241
TEST=sync_integration_tests
Review URL: http://codereview.chromium.org/6404003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rwxr-xr-x | net/tools/testserver/testserver.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py index eb2a02e..871e540 100755 --- a/net/tools/testserver/testserver.py +++ b/net/tools/testserver/testserver.py @@ -1389,8 +1389,11 @@ class FileMultiplexer: def main(options, args): logfile = open('testserver.log', 'w') - sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) + if options.log_to_console: + sys.stdout = FileMultiplexer(sys.stdout, logfile) + else: + sys.stdout = logfile port = options.port @@ -1489,6 +1492,11 @@ if __name__ == '__main__': const=SERVER_SYNC, default=SERVER_HTTP, dest='server_type', help='start up a sync server.') + option_parser.add_option('', '--log-to-console', action='store_const', + const=True, default=False, + dest='log_to_console', + help='Enables or disables sys.stdout logging to ' + 'the console.') option_parser.add_option('', '--port', default='0', type='int', help='Port used by the server. If unspecified, the ' 'server will listen on an ephemeral port.') |