Closed Endermandels closed 1 month ago
Thanks for the input and I see you did a lot of work here, but, I'd like to stick with a less invasive method to control logging.
I'm not an expert at use of the logging module, but had done some work at looking into things like this in the past - have you explored it? Take a look at this section toward the end of caltopo_python.py:
# print by default; let the caller change this if needed
# (note, caller would need to clear all handlers first,
# per stackoverflow.com/questions/12158048)
logging.basicConfig(
level=logging.INFO,
datefmt='%H:%M:%S',
format='%(asctime)s [%(module)s:%(lineno)d:%(levelname)s] %(message)s',
handlers=[
logging.StreamHandler(sys.stdout)
]
)
According to that stackoverflow question and its accepted answer, a user should be able to turn logging on or off with one line of downstream code. It's not necessarily a user-friendly line of code, but, it would be a lot less invasive (actually, non-invasive) to caltopo_python.py. Since I don't have unit tests set up, I feel that any change that touches this many lines of the module would probably require manual retest of every bit of functionality.
Also I would kind of like the default to be on rather than off. I do know a lot of the logging.info lines could be changed to logging.debug or such to gain more granularity, but, I think making full use of the logging module rather than overriding it's functionality with another variable is probably the way to go. Thanks
Thank you for the feedback. I did not consider that the logging module allowed for toggling the logging. That would be a much better way of going about it, and less invasive. I can also get having the default being on because it is better to give more information than less.
The solution you mentioned works like a charm. It's much easier than I imagined. Thanks!
Glad to hear it. Don't hesitate to bring up other issues / ideas / contributions.
On Wed, Aug 21, 2024 at 12:40 PM Endermandels @.***> wrote:
The solution you mentioned works like a charm. It's much easier than I imagined. Thanks!
— Reply to this email directly, view it on GitHub https://github.com/ncssar/caltopo_python/pull/21#issuecomment-2302879633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEPCEZROBX55TONTNCT236DZSTULPAVCNFSM6AAAAABMOSEQOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBSHA3TSNRTGM . You are receiving this because you commented.Message ID: @.***>
Allow users to toggle logging info terminal output. This would give users the option to clean up the terminal output while using the caltopo_python module.