Metadata-Version: 2.1
Name: looplog
Version: 0.0.7
Summary: A little helper to log warnings/errors for processed
Author-email: Olivier Dalang <olivier.dalang@gmail.com>
License: MIT License
Project-URL: homepage, https://github.com/olivierdalang/looplog
Project-URL: repository, https://github.com/olivierdalang/looplog
Project-URL: tracker, https://github.com/olivierdalang/looplog/issues
Keywords: logging,warnings,errors
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.0
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pre-commit ; extra == 'dev'

# Looplog

Looplog is a simple helper to log processing done in a loop, catching errors and warnings to produce a readble
console output, both interactively and not.

Quickly see how it looks with the demo.

```bash
python -m looplog.demo
```

## Usage

Decorate you function with `@looplog(items)` like this.

```python
from looplog import SKIP, looplog

@looplog([1, 2, 3, 4, 5, 6, 7, 8, "9", 10, 11.5, 12, 0, 13, None, 15])
def func_basic(value):
    if value is None:
        return SKIP
    if isinstance(value, float) and not value.is_integer():
        warnings.warn("Input will be rounded !")
    10 // value

# [to stdout in realtime]
# Starting loop `func_basic`
# ..........!.X.-....X.

print(func_basic.details())

# ================================================================================
# WARNING step_11: Input will be rounded !
# ================================================================================
# ERROR step_13: integer division or modulo by zero
# ================================================================================
# ERROR step_20: unsupported operand type(s) for //: 'int' and 'str'
# ================================================================================

print(func_basic.summary())

# 17 ok / 1 warn / 2 err / 1 skip
```

Check the looplog docstring for some additional features (logging, limit, etc.).

## Contribute

```bash
# install pre-commit
pip install pre-commit
pre-commit install

# run tests
python -m tests
```
