MCPcopy
hub / github.com/ActivityWatch/activitywatch / line_age

Function line_age

scripts/logcrawler.py:41–50  ·  view source on GitHub ↗

Returns line age in days

(line)

Source from the content-addressed store, hash-verified

39
40
41def line_age(line):
42 """Returns line age in days"""
43 match = _date_reg_exp.search(line)
44 if not match:
45 logging.warning("Line had no date, avoid multiple line messages in logs. Line will have its age set to zero.")
46 return 0
47 else:
48 dt = datetime.strptime(match.group(), '%Y-%m-%d')
49 td = today - dt
50 return td.days
51
52
53def main(exclude_testing: bool = False, limit_days: int = 10, limit_lines: int = 10):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected