| OLD | NEW |
| 1 # Copyright (C) 2012 Google, Inc. | 1 # Copyright (C) 2012 Google, Inc. |
| 2 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 2 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions | 5 # modification, are permitted provided that the following conditions |
| 6 # are met: | 6 # are met: |
| 7 # 1. Redistributions of source code must retain the above copyright | 7 # 1. Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # 2. Redistributions in binary form must reproduce the above copyright | 9 # 2. Redistributions in binary form must reproduce the above copyright |
| 10 # notice, this list of conditions and the following disclaimer in the | 10 # notice, this list of conditions and the following disclaimer in the |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 def configure(self, options): | 48 def configure(self, options): |
| 49 self.options = options | 49 self.options = options |
| 50 | 50 |
| 51 if options.timing: | 51 if options.timing: |
| 52 # --timing implies --verbose | 52 # --timing implies --verbose |
| 53 options.verbose = max(options.verbose, 1) | 53 options.verbose = max(options.verbose, 1) |
| 54 | 54 |
| 55 log_level = logging.INFO | 55 log_level = logging.INFO |
| 56 if options.quiet: | 56 if options.quiet: |
| 57 log_level = logging.WARNING | 57 log_level = logging.WARNING |
| 58 elif options.verbose == 2: | 58 elif options.verbose >= 2: |
| 59 log_level = logging.DEBUG | 59 log_level = logging.DEBUG |
| 60 | 60 |
| 61 self.meter = MeteredStream(self.stream, (options.verbose == 2), | 61 self.meter = MeteredStream(self.stream, (options.verbose >= 2), |
| 62 number_of_columns=SystemHost().platform.terminal_width()) | 62 number_of_columns=SystemHost().platform.terminal_width()) |
| 63 | 63 |
| 64 handler = logging.StreamHandler(self.stream) | 64 handler = logging.StreamHandler(self.stream) |
| 65 # We constrain the level on the handler rather than on the root | 65 # We constrain the level on the handler rather than on the root |
| 66 # logger itself. This is probably better because the handler is | 66 # logger itself. This is probably better because the handler is |
| 67 # configured and known only to this module, whereas the root logger | 67 # configured and known only to this module, whereas the root logger |
| 68 # is an object shared (and potentially modified) by many modules. | 68 # is an object shared (and potentially modified) by many modules. |
| 69 # Modifying the handler, then, is less intrusive and less likely to | 69 # Modifying the handler, then, is less intrusive and less likely to |
| 70 # interfere with modifications made by other modules (e.g. in unit | 70 # interfere with modifications made by other modules (e.g. in unit |
| 71 # tests). | 71 # tests). |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 import inspect | 203 import inspect |
| 204 import pdb | 204 import pdb |
| 205 stack = inspect.stack() | 205 stack = inspect.stack() |
| 206 return any(frame[1] == pdb.__file__.replace('.pyc', '.py') for frame in
stack) | 206 return any(frame[1] == pdb.__file__.replace('.pyc', '.py') for frame in
stack) |
| 207 | 207 |
| 208 def flush(self): | 208 def flush(self): |
| 209 self._stream.flush() | 209 self._stream.flush() |
| 210 | 210 |
| 211 def getvalue(self): | 211 def getvalue(self): |
| 212 return self._buffer.getvalue() | 212 return self._buffer.getvalue() |
| OLD | NEW |