def formatTime(self, record, datefmt=None): """logging uses time.strftime which doesn't understand how to add microsecs. datetime understands that. so we have to work around the old time.strftime here.""" if datefmt: datefmt = datefmt.replace('%f', '%03d' % record.msecs) return Formatter.formatTime(self, record, datefmt) else: return Formatter.formatTime(self, record, datefmt) # default ISO8601
def formatTime(self, record, datefmt=None): """logging uses time.strftime which doesn't understand how to add microsecs. datetime understands that. so we have to work around the old time.strftime here.""" if datefmt: # fluent-bit compatible format: 2019-11-28 06:05:54.823 # instead of: 2019-11-28 06:05:54.82317781 datefmt = datefmt.replace(u'%f', u'%03d' % (record.msecs)) return Formatter.formatTime(self, record, datefmt) else: return Formatter.formatTime(self, record, datefmt) # default ISO8601
def formatTime(self, record, datefmt=None): ''' @override logging.Formatter.formatTime default case: microseconds is added otherwise: add microseconds mannually''' asctime = Formatter.formatTime(self, record, datefmt=datefmt) return asctime if datefmt is None or datefmt == '' else self.default_msec_format % ( asctime, record.msecs)
def formatTime(self, record, datefmt=None): if datefmt is None: datefmt = "%H:%M:%S" ret = Formatter.formatTime(self, record, datefmt) ret = "%s.%03d" % (ret, record.msecs) return ret
def formatTime(self, record, datefmt=None): return Formatter.formatTime( self, record, '%Y-%m-%d %H:%M:%S') + '.%04d' % (record.msecs * 10)
def formatTime(self, record, datefmt=None): # Old-style class in python < 2.7 string = Formatter.formatTime(self, record, datefmt).decode('utf-8') return unicode(string)
def formatTime(self, record, datefmt=None): return Formatter.formatTime(self, record, '%Y-%m-%d %H:%M:%S') + '.%04d' % (record.msecs * 10)