Home | History | Annotate | Download | only in bin
      1 import common
      2 import logging, os
      3 from autotest_lib.client.common_lib import logging_config, global_config
      4 
      5 class ClientLoggingConfig(logging_config.LoggingConfig):
      6     def add_debug_file_handlers(self, log_dir, log_name=None):
      7         if not log_name:
      8             log_name = global_config.global_config.get_config_value(
      9                     'CLIENT', 'default_logging_name',
     10                     type=str, default='client')
     11         self._add_file_handlers_for_all_levels(log_dir, log_name)
     12 
     13 
     14     def configure_logging(self, results_dir=None, verbose=False):
     15         super(ClientLoggingConfig, self).configure_logging(
     16                                                   use_console=self.use_console,
     17                                                   verbose=verbose)
     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)
     24