MCPcopy Create free account
hub / github.com/Closed11/Unsupervised-Image-Classification / LogFormatter

Class LogFormatter

UIC/util.py:22–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 self.avg = self.sum / self.count
21
22class LogFormatter():
23 def __init__(self):
24 self.start_time = time.time()
25
26 def format(self, record):
27 elapsed_seconds = round(record.created - self.start_time)
28
29 prefix = "%s - %s - %s" % (
30 record.levelname,
31 time.strftime('%x %X'),
32 timedelta(seconds=elapsed_seconds)
33 )
34 message = record.getMessage()
35 message = message.replace('\n', '\n' + ' ' * (len(prefix) + 3))
36 return "%s - %s" % (prefix, message) if message else ''
37
38
39def create_logger(filepath):

Callers 1

create_loggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected