blob: 6d97035fc63653a3af5f44c36165066aecb266cf [file] [log] [blame]
Aviv Keshete43bccf2013-08-14 14:11:59 -07001#pylint: disable-msg=C0111
showard75cdfee2009-06-10 17:40:41 +00002import common
3import logging, os
4from autotest_lib.client.common_lib import logging_config
5
6class ServerLoggingConfig(logging_config.LoggingConfig):
7 def add_debug_file_handlers(self, log_dir, log_name=None):
8 if not log_name:
9 log_name = 'autoserv'
showardf2de81b2009-06-15 20:23:10 +000010 self._add_file_handlers_for_all_levels(log_dir, log_name)
showard75cdfee2009-06-10 17:40:41 +000011
12
showard10d84172009-06-18 23:16:50 +000013 def configure_logging(self, results_dir=None, use_console=True,
Aviv Keshete43bccf2013-08-14 14:11:59 -070014 verbose=False, no_console_prefix=False,
15 debug_log_name=None):
showard10d84172009-06-18 23:16:50 +000016 if no_console_prefix:
17 self.console_formatter = logging.Formatter()
18
19 super(ServerLoggingConfig, self).configure_logging(use_console, verbose)
showard75cdfee2009-06-10 17:40:41 +000020
21 if results_dir:
22 log_dir = os.path.join(results_dir, 'debug')
23 if not os.path.exists(log_dir):
24 os.mkdir(log_dir)
Aviv Keshete43bccf2013-08-14 14:11:59 -070025 self.add_debug_file_handlers(log_dir, log_name=debug_log_name)