Skip to content

Enhancement of Logging System in Modbus Package #79

@ValentinMontmirail

Description

@ValentinMontmirail

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions