google / google/python-fire

Feature Request: Add logging level support as a default parameter for functions

Offen
#140 1 Kommentar 10 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Python
Sterne
28.2k
Forks
1.5k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

It would be nice to add a logging level option as a default option for all methods.

An ideal implementation would be like a decorator for a function: when a function is decorated, then the function will be added with `[--log-level INFO]` without specifying so.

For example, a method with a decorator:
```puthon
@fire.logger(logger_object):
def a_method(params1):
logger_object.debug('log line')
```

Will actually make `a_method(param1)` works like `a_method(param1, log_level=logging.INFO)`.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.