Skip to content

Latest commit

 

History

History
101 lines (74 loc) · 2.1 KB

File metadata and controls

101 lines (74 loc) · 2.1 KB

icon

logtime

Logtime allows you to keep track of time spent on different tasks in plain text and report on it using Python. It uses the following syntax:

# comment
2016-09-26 14:00
# ↑ start time
programming / logtime / readme  
# ↑ tag 1     ↑ tag 2   ↑ tag 3
2016-09-26 15:00  
# ↑ end time of "programming / logtime / readme" and at he same time start time of "programming / finanse"
programming / finanse
# ↑ tag 1     ↑ tag 2
2016-09-26 16:00  
# ↑ end time of "programming - finanse"

This file format is designed to allow to start and end tracking task by simply appending to a file. Text can be parsed into Log, which is basically list of LogItems. LogItem has start time, end time and ordered list of tags.

from logtime import Log

log = Log("""2016-09-26 14:00
tv / steven universe
2016-09-26 15:00
eating / spiders
2016-09-26 15:15
programming / logtime / readme
2016-09-26 17:45
programming / finanse
""")

Log can be filtered, using simple query language:

>>> print('programming or tv[2016-09-26 14:30;2016-09-26 15:30]')
2016-09-26 14:30
tv / steven universe
2016-09-26 15:00
2016-09-26 15:15
programming / logtime / readme
2016-09-26 15:30

Query language uses boolean operators and parentheses to match tags and slices to slice time.

Log can be grouped:

>>> print(log.group(0))
eating = 0:15:00
programming = 3:45:00
tv = 1:00:00

As an argument to .filter and .group you can either pass a function that will receive LogItems or a string.

Log can also be summed:

>>> print(log.sum())
5:00:00

Report

report module includes simple command line reporting tools:

from logtime import report

report.print_progress(log, goal=timedelta(hours=8))

progress

report.print_timeline(
    log, start=datetime(2016, 9, 26, 14), end=datetime(2016, 9, 26, 18)
)

timeline

report.print_breakdown(log)

breakdown

Installation

All manual for now.

License

Copyright 2016 Piotr Wilczyński. Licensed under the MIT License.