| showard | 75cdfee | 2009-06-10 17:40:41 +0000 | [diff] [blame] | 1 | import common | 
 | 2 | import logging, os | 
 | 3 | from autotest_lib.client.common_lib import logging_config | 
 | 4 |  | 
 | 5 | class ServerLoggingConfig(logging_config.LoggingConfig): | 
 | 6 |     def add_debug_file_handlers(self, log_dir, log_name=None): | 
 | 7 |         if not log_name: | 
 | 8 |             log_name = 'autoserv' | 
| showard | f2de81b | 2009-06-15 20:23:10 +0000 | [diff] [blame] | 9 |         self._add_file_handlers_for_all_levels(log_dir, log_name) | 
| showard | 75cdfee | 2009-06-10 17:40:41 +0000 | [diff] [blame] | 10 |  | 
 | 11 |  | 
| showard | 10d8417 | 2009-06-18 23:16:50 +0000 | [diff] [blame] | 12 |     def configure_logging(self, results_dir=None, use_console=True, | 
 | 13 |                           verbose=False, no_console_prefix=False): | 
 | 14 |         if no_console_prefix: | 
 | 15 |             self.console_formatter = logging.Formatter() | 
 | 16 |  | 
 | 17 |         super(ServerLoggingConfig, self).configure_logging(use_console, verbose) | 
| showard | 75cdfee | 2009-06-10 17:40:41 +0000 | [diff] [blame] | 18 |  | 
 | 19 |         if results_dir: | 
 | 20 |             log_dir = os.path.join(results_dir, 'debug') | 
 | 21 |             if not os.path.exists(log_dir): | 
 | 22 |                 os.mkdir(log_dir) | 
 | 23 |             self.add_debug_file_handlers(log_dir) |