C import logging logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s') logging.warning(‘%s was logged.‘, ‘this event’) 2010-12-12 11:41:42,612 WARNING this event was logged.
application code directly uses. • Handlers: send the log records (created by loggers) to the appropriate destination. • Formatters: specify the layout of log records in the final output. • Filters: provide a finer grained facility for determining which log records to output.
name): if name == 'ip': result = '192.168.0.1' else: result = self.__dict__.get(name, '?') return result def __iter__(self): keys = ['ip'] keys.extend(self.__dict__.keys()) return keys.__iter__()