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

Side by Side Diff: client/common_lib/logging_manager.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 import logging, os, signal, sys, warnings 1 import logging, os, signal, sys, warnings
2 2
3 # primary public APIs 3 # primary public APIs
4 4
5 def configure_logging(logging_config, **kwargs): 5 def configure_logging(logging_config, **kwargs):
6 """ 6 """
7 Configure the logging module using the specific configuration object, which 7 Configure the logging module using the specific configuration object, which
8 should be an instance of logging_config.LoggingConfig (usually of a 8 should be an instance of logging_config.LoggingConfig (usually of a
9 subclass). Any keyword args will be passed to the object's 9 subclass). Any keyword args will be passed to the object's
10 configure_logging() method. 10 configure_logging() method.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ### START additional code. 72 ### START additional code.
73 if co in _caller_code_to_skip_in_logging_stack: 73 if co in _caller_code_to_skip_in_logging_stack:
74 f = f.f_back 74 f = f.f_back
75 continue 75 continue
76 ### END additional code. 76 ### END additional code.
77 rv = (filename, f.f_lineno, co.co_name) 77 rv = (filename, f.f_lineno, co.co_name)
78 break 78 break
79 return rv 79 return rv
80 80
81 81
82 if sys.version_info[:2] > (2, 6): 82 if sys.version_info[:2] > (2, 7):
83 warnings.warn('This module has not been reviewed for Python %s' % 83 warnings.warn('This module has not been reviewed for Python %s' %
84 sys.version) 84 sys.version)
85 85
86 86
87 # Monkey patch our way around logging's design... 87 # Monkey patch our way around logging's design...
88 _original_logger__find_caller = logging.Logger.findCaller 88 _original_logger__find_caller = logging.Logger.findCaller
89 logging.Logger.findCaller = _logging_manager_aware_logger__find_caller 89 logging.Logger.findCaller = _logging_manager_aware_logger__find_caller
90 90
91 91
92 class LoggingFile(object): 92 class LoggingFile(object):
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 # spawn the initial logging subprocess 607 # spawn the initial logging subprocess
608 self._push_context(self._get_context()) 608 self._push_context(self._get_context())
609 609
610 610
611 def undo_redirect(self): 611 def undo_redirect(self):
612 # len == 1 would mean only start_logging() had been called (but no 612 # len == 1 would mean only start_logging() had been called (but no
613 # redirects had occurred) 613 # redirects had occurred)
614 if len(self._context_stack) < 2: 614 if len(self._context_stack) < 2:
615 raise RuntimeError('No redirects to undo') 615 raise RuntimeError('No redirects to undo')
616 super(FdRedirectionLoggingManager, self).undo_redirect() 616 super(FdRedirectionLoggingManager, self).undo_redirect()
OLDNEW
« cli/job.py ('K') | « client/common_lib/error.py ('k') | client/common_lib/magic.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698