3cky / mbusd

Open-source Modbus TCP to Modbus RTU (RS-232/485) gateway.
BSD 3-Clause "New" or "Revised" License
575 stars 219 forks source link

Logging fix and enhancement #90

Closed kpr0th closed 11 months ago

kpr0th commented 1 year ago

Corrected issue where loglevel in mbusd.conf wasn't parsed correctly. Added support for logfile in mbusd.conf. Enhanced validation for loglevel and logfile [added missing validation in cfg.c, fixed error message for loglevel > 2 in non-DEBUG mode, added checks for missing logfile name which was previously treated as STDOUT only). Updated README and mbusd..conf.example to true-up with "-h" output and new logging options.

kpr0th commented 11 months ago

@3cky -- I noticed you made some recent changes. And picked up some of my suggested edits but not all of them. I merged in your upstream changes and then rebased my changes and added a couple more minor cleanups to sync the README and -h details. Note that my code changes were mainly to shore up command line parsing -- I think one or two of the logging-related options didn't actually take effect previously, and invalid parameter values would sometimes crash the app or at least result in unexpected logging options occurring; with the fixes I'm proposing, the logging code is a good bit more robust.

Please consider pulling in this PR now that it should merge cleanly again.

3cky commented 11 months ago

Merged. Thanks @kpr0th !