pleiszenburg / zugbruecke

Calling routines in Windows DLLs from Python scripts running under Linux, MacOS or BSD
https://zugbruecke.readthedocs.io/en/latest/
GNU Lesser General Public License v2.1
108 stars 11 forks source link

logging fails when activated by set_parameter() #77

Closed stefnet00 closed 1 year ago

stefnet00 commented 2 years ago

I tried to activate the log of zugbruecke within the session via zugbruecke.current_session.set_parameter(dict(log_write=True, log_level=10)) and got an error.

(1632991999.73/c9d5edc7) UNIX o: [session-client] TERMINATING ...
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "[...]/python3.6/site-packages/zugbruecke/core/session_client.py", line 251, in terminate
    self.log.out('[session-client] TERMINATING ...')
  File "[...]/python3.6/site-packages/zugbruecke/core/log.py", line 209, in out
    self.__process_message__(message, 'out', level)
  File "[...]/python3.6/site-packages/zugbruecke/core/log.py", line 175, in __process_message__
    self.__process_message_dict__(mesage_dict)
  File "[...]/python3.6/site-packages/zugbruecke/core/log.py", line 186, in __process_message_dict__
    self.__store_message__(mesage_dict)
  File "[...]/python3.6/site-packages/zugbruecke/core/log.py", line 201, in __store_message__
    f = open(self.f[message['pipe']], 'a+')
AttributeError: 'log_class' object has no attribute 'f'

Same was the case when creating a new session zugbruecke.current_session = zugbruecke.session(parameter=dict(log_write=True,log_level=10)).

Logging was successful when using a json file ~/.zugbruecke/.zugbruecke.json containing {"log_write": true, "log_level": 10}.

s-m-e commented 2 years ago

Yep, that's indeed a bug that needs fixing. Thanks for the report.

s-m-e commented 2 years ago

It's also present in the develop branch, so I can not point you to this one either as a temporary solution.

stefnet00 commented 2 years ago

Well, I use the json file instead. That's ok for now.

s-m-e commented 1 year ago

Fix released as part of v0.2.0.