https://github.com/thesage21/plog
Parallel socket based logging to csv files.
https://github.com/thesage21/plog
Last synced: about 1 month ago
JSON representation
Parallel socket based logging to csv files.
- Host: GitHub
- URL: https://github.com/thesage21/plog
- Owner: theSage21
- License: mit
- Created: 2016-11-02T07:17:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-02T08:46:38.000Z (over 8 years ago)
- Last Synced: 2025-01-28T21:28:55.732Z (3 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Plog
====Quick and dirty logging for parallel tasks.
Usage
-----1. Run `python plog.py report.csv`. We call this the `logging` process.
2. Run your program which spawns processes/threads which need to report to some
kind of a log. We call this the `supplier` process.
3. Wait for the supplier to stop running.
3. `Ctrl+C` the logging process to flush any logs in memory to disk.In your `supplier` process, the worker function is the one which needs to call
the `addlog` function from `plog.py` to add a log.For example a sample `supplier` program may do this:
```python
from plog import addlog
from multiprocessing import Pooldef worker(i):
string = '{},{}'.format(i, i**2)
addlog(string)with Pool() as pool:
pool.map(worker, range(10000))
```