vectorgrp / sil-kit

Vector SIL Kit – Open-Source Library for Connecting Software-in-the-Loop Environments
https://vectorgrp.github.io/sil-kit-docs
MIT License
107 stars 32 forks source link

Logger lifecycle #139

Open kocho1984 opened 3 weeks ago

kocho1984 commented 3 weeks ago

Hi,

  1. Is it possible to log to a file with ILogger before a participant is created? Use case: Attempting to create a participant throws an exception and the user wants to log this to a file.

  2. Can the logger returned by participant->GetLogger() still be used after the participant has been destroyed? Use case: User wants to log to a file that participant has been destroyed.

VDanielEdwards commented 3 weeks ago

Hello @kocho1984, thank you for your questions!

  1. Creation of a participant is required to get access to the logger object and there is no way to create logger object otherwise.
  2. The logger cannot be used after the participant it belongs to has been destroyed and there is no way to extend it's lifetime beyond that.

However, I do see that both, logging before participant creation, and after participant destruction may be an interesting features for users. I'll create internal issues to track these use-cases and we'll discuss these internally. I cannot promise any outcome though.

Thank you for your patience 👍

kocho1984 commented 3 weeks ago

@VDanielEdwards: In case createParticipant throws an exception, I think logging it to a file would be useful. Currently, logger cannot exist without a participant.

Thank you for your consideration.