from .config import LDAPMigrationConfiguration
-__version__ = '0.9.1'
+__version__ = '0.9.2'
LOG = logging.getLogger(__name__)
CFG_BASENAME = 'ldap-migration.ini'
self.structural_dns_file = None
self.migrated_file = None
self.general_logfile = None
+ self.error_logfile = None
self.lap = 0
self.total_count = 0
return formatter
# -------------------------------------------------------------------------
- def _get_logfile_formatter(self):
+ def _get_logfile_formatter(self, full=False):
format_str = '[%(asctime)s]: '
format_str += self.appname + ': '
- if self.verbose > 1:
+ if self.verbose > 1 or full:
format_str += '%(name)s(%(lineno)d) %(funcName)s() '
else:
format_str += '%(name)s '
lh_file.setFormatter(lf_formatter)
root_logger.addHandler(lh_file)
+ # creating a log handler for errors
+ lf_formatter_err = self._get_logfile_formatter(full=True)
+ lh_errorlog = logging.FileHandler(
+ str(self.error_logfile), mode='a', encoding='utf-8', delay=True)
+ lh_errorlog.setLevel(logging.WARNING)
+ lh_errorlog.setFormatter(lf_formatter_err)
+ root_logger.addHandler(lh_errorlog)
+
return
# -------------------------------------------------------------------------
self.structural_dns_file = self.log_dir / 'structural-dns.{}.txt'.format(file_timestamp)
self.migrated_file = self.log_dir / 'migrated-entries.{}.txt'.format(file_timestamp)
self.general_logfile = self.log_dir / 'migration.{}.log'.format(file_timestamp)
+ self.error_logfile = self.log_dir / 'error.{}.log'.format(file_timestamp)
self.init_logging()