Skip to content

Support for debug() under Printer? #15

@narayanacharya6

Description

@narayanacharya6

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? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions