From 27b22f8bc569cb2719941057d228da7494c74689 Mon Sep 17 00:00:00 2001 From: jgstew Date: Thu, 29 Feb 2024 10:13:31 -0500 Subject: [PATCH] add logging initialization only if run directly --- src/besapi/__main__.py | 4 ++++ src/besapi/besapi.py | 1 + src/bescli/__main__.py | 4 ++++ src/bescli/bescli.py | 1 + 4 files changed, 10 insertions(+) diff --git a/src/besapi/__main__.py b/src/besapi/__main__.py index 6269c0c..f1aee0d 100644 --- a/src/besapi/__main__.py +++ b/src/besapi/__main__.py @@ -1,6 +1,10 @@ """ To run this module directly """ + +import logging + from bescli import bescli +logging.basicConfig() bescli.main() diff --git a/src/besapi/besapi.py b/src/besapi/besapi.py index eda70c1..e55b314 100644 --- a/src/besapi/besapi.py +++ b/src/besapi/besapi.py @@ -999,4 +999,5 @@ def main(): if __name__ == "__main__": + logging.basicConfig() main() diff --git a/src/bescli/__main__.py b/src/bescli/__main__.py index 789509e..ff6901a 100644 --- a/src/bescli/__main__.py +++ b/src/bescli/__main__.py @@ -1,6 +1,10 @@ """ To run this module directly """ + +import logging + from . import bescli +logging.basicConfig() bescli.main() diff --git a/src/bescli/bescli.py b/src/bescli/bescli.py index 9bc5dd3..398bbed 100644 --- a/src/bescli/bescli.py +++ b/src/bescli/bescli.py @@ -421,4 +421,5 @@ def main(): if __name__ == "__main__": + logging.basicConfig() main()