-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Description
The current implementation of the logger interface in our Modbus package exclusively uses the Printf method for logging. This approach inherently treats all logs as INFO level, which is not always appropriate. Many of these logs are more suited to a DEBUG level, particularly given their nature and the detail they provide.
Problem
The primary issue with the current logging system is the lack of granularity. Without distinct log levels (such as DEBUG, INFO, ERROR), it becomes challenging to filter logs based on their severity or importance. This limitation hinders effective debugging and monitoring, especially in production environments where log verbosity needs to be controlled.
Proposed Solution:
-
Introduce a Refined Logger Interface: Implement a more sophisticated logger interface that includes methods for different log levels - Debug, Info, and Error. This change will align our logging practices with standard approaches and provide much-needed flexibility.
-
Utilize Standard Logging Libraries: Consider adopting standard logging libraries like Go's slog, which inherently support multiple log levels. This move would not only enhance our logging capabilities but also ensure consistency with common logging practices in the industry.
-
Reclassify Existing Logs: Review and reclassify existing log statements in the Modbus package to their appropriate log levels. This reclassification will ensure that logs are more meaningful and contextually relevant.
-
Expand Debugging Logs: With the introduction of a Debug log level, we can add more detailed debugging logs throughout the Modbus package. These logs would be invaluable for development and troubleshooting, and they can be easily filtered out in a production setting to reduce noise.