blob: 83b94167028660e9618d83eed397aaac13b7e42b [file] [log] [blame]
showard75cdfee2009-06-10 17:40:41 +00001import common
2import logging, os
3from autotest_lib.client.common_lib import logging_config
4
5class 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'
showardf2de81b2009-06-15 20:23:10 +00009 self._add_file_handlers_for_all_levels(log_dir, log_name)
showard75cdfee2009-06-10 17:40:41 +000010
11
showard10d84172009-06-18 23:16:50 +000012 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)
showard75cdfee2009-06-10 17:40:41 +000018
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)