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

Side by Side Diff: tools/python/google/logging_utils.py

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/python/google/httpd_utils.py ('k') | tools/python/google/path_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/env python 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 3 # found in the LICENSE file.
5 4
6 # logging_utils.py
7
8 ''' Utility functions and objects for logging. 5 ''' Utility functions and objects for logging.
9 ''' 6 '''
10 7
11 import logging 8 import logging
12 import sys 9 import sys
13 10
14 class StdoutStderrHandler(logging.Handler): 11 class StdoutStderrHandler(logging.Handler):
15 ''' Subclass of logging.Handler which outputs to either stdout or stderr 12 ''' Subclass of logging.Handler which outputs to either stdout or stderr
16 based on a threshold level. 13 based on a threshold level.
17 ''' 14 '''
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 ''' 73 '''
77 # to set the handler of the root logging object, we need to do setup 74 # to set the handler of the root logging object, we need to do setup
78 # manually rather than using basicConfig 75 # manually rather than using basicConfig
79 root = logging.getLogger() 76 root = logging.getLogger()
80 root.setLevel(level) 77 root.setLevel(level)
81 formatter = logging.Formatter(format, datefmt) 78 formatter = logging.Formatter(format, datefmt)
82 handler = StdoutStderrHandler(threshold=threshold) 79 handler = StdoutStderrHandler(threshold=threshold)
83 handler.setLevel(level) 80 handler.setLevel(level)
84 handler.setFormatter(formatter) 81 handler.setFormatter(formatter)
85 root.addHandler(handler) 82 root.addHandler(handler)
86
OLDNEW
« no previous file with comments | « tools/python/google/httpd_utils.py ('k') | tools/python/google/path_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698