explosion / explosion/wasabi

Support for `debug()` under `Printer`?

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
471
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Currently if I wish to print debug messages, the usage is something like this:

```
from wasabi import msg
msg.info('Hello', show=is_verbose)
```

But now `is_verbose` is scattered everywhere in code. I'd like to propose a class-level variable for `Printer` that sets the `is_verbose` flag once with the `Printer` and a `msg.debug()` function that will print based on this flag. Essentially a flag for log level is what I am looking for.

Proposed Usage:
```
from wasabi import Printer
msg = Printer(is_verbose=True)
msg.debug('Hello') # This prints to console
msg = Printer(is_verbose=False)
msg.debug('Hello') # This does not print to console
```

Let me know if this usage makes sense and I can contribute a PR or maybe there is an existing way to achieve this functionality that I am probably now aware of? :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.