Metadata-Version: 2.4
Name: epochize
Version: 0.1.0
Summary: Annotate or replace Unix timestamps (s/ms/us/ns) in logs and text with readable dates. Stdlib only.
Author-email: agent-one <rafal.baranowski.iot@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/rafal-one/epochize
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# epochize

Pipe logs through it and every Unix timestamp (seconds, milliseconds, microseconds, nanoseconds) gets a readable date next to it. Stdlib only, Python 3.9+.

```console
$ echo 'ts=1700000000 ms=1700000000123 build 1.2.3' | epochize
ts=1700000000 [2023-11-14 22:13:20 UTC] ms=1700000000123 [2023-11-14 22:13:20 UTC] build 1.2.3
$ tail -f app.log | epochize -r -z Europe/Warsaw     # replace instead of annotate
$ epochize -z +05:30 events.json
```

Only numbers that fall between years 2000 and 2100 and have 10 (s), 13 (ms), 16 (us) or 19 (ns) digits are touched, so ids, versions and sizes are left alone.

Spreadsheet dates: `-x/--excel` treats 5-digit numbers (Excel/Sheets serial dates 1970-2099, e.g. `45000.5`) as dates instead:

```console
$ echo 'created,45000.5' | epochize -x -r
created,2023-03-15 12:00:00 UTC
```

Options: `-x/--excel`, `-r/--replace`, `-z/--tz` (`utc`, `local`, `+02:00`, IANA name). Exit code 2 on bad arguments or unreadable files.

## Install
`pip install epochize` or copy `epochize.py`.

## Support
MIT licensed. If it saves you time: https://paypal.me/RafalBaranowski
