Skip to content

Commit

Permalink
logging: fix early logging (#49)
Browse files Browse the repository at this point in the history
Enable logging through logger objects early in the instantiation of
collectors. Without explicitly calling `logging.basicConfig()`, any
calls to `logging.getLogger(...).info(...)` and `...debug(...)` produce
no output until `logging.log(...)` or friends were called once.
  • Loading branch information
olaf-mandel authored Oct 6, 2024
1 parent fb5a956 commit 50cfcd8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions p3exporter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def main():
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGINT, signal_handler)

logging.basicConfig()
logging.getLogger().setLevel(logging.INFO)

parser = argparse.ArgumentParser(description="Python programmable Prometheus exporter.")
Expand Down

0 comments on commit 50cfcd8

Please sign in to comment.