Skip to content

Commit 4e3a333

Browse files
committed
handle case where log file is not specified
1 parent 67daf6b commit 4e3a333

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

netfoundry/organization.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def __init__(self,
4747
proxy: str = None):
4848
"""Initialize an instance of organization."""
4949
# set debug and file if specified and let the calling application dictate logging handlers
50+
self.log_file = log_file
51+
self.debug = debug
5052
if logger:
5153
# print(f"using logger '{logger}' from param")
5254
self.logger = logger
@@ -56,11 +58,10 @@ def __init__(self,
5658
# self.logger = logger or logging.getLogger(__name__)
5759
self.logger.addHandler(logging.NullHandler())
5860

59-
if debug:
60-
self.debug = debug
61+
if self.debug:
6162
self.logger.setLevel(logging.DEBUG)
62-
if log_file:
63-
self.log_file = log_file
63+
64+
if self.log_file:
6465
file_handler = logging.FileHandler(log_file, encoding='utf-8')
6566
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
6667
formatter.converter = time.gmtime

0 commit comments

Comments
 (0)