You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We’ve identified an issue with the Logger class in the current implementation (cc @Laughing-q ). Specifically, the use of print statements within the info and warning methods is causing problems with logging suppression and control. This behavior is not ideal for a logging utility, as it bypasses the logging framework and makes it difficult to manage log output effectively.
The print statements in the info and warning methods directly output messages to the console, regardless of the logging level or configuration. This bypasses the logging framework, making it impossible to suppress these messages when needed (e.g., in production environments where only errors or critical logs are required).
The print statements create inconsistency in log handling. For example, if the logging level is set to ERROR or CRITICAL, the info and warning logs should not be displayed. However, because of the print statements, these messages are still printed to the console, which defeats the purpose of setting a logging level.
Since the print statements duplicate the log messages, the same message appears twice: once from the print statement and once from the actual logger. This redundancy can clutter the console and log files, making it harder to read and analyze logs.
Issue Type
Bug
Source
pip (model-compression-toolkit)
MCT Version
2.1.1
OS Platform and Distribution
Linux Ubuntu 22.04
Python version
3.11
Describe the issue
We’ve identified an issue with the
Logger
class in the current implementation (cc @Laughing-q ). Specifically, the use of print statements within the info and warning methods is causing problems with logging suppression and control. This behavior is not ideal for a logging utility, as it bypasses the logging framework and makes it difficult to manage log output effectively.model_optimization/model_compression_toolkit/logger.py
Lines 131 to 152 in 4cb7162
Additional problems:
The print statements in the info and warning methods directly output messages to the console, regardless of the logging level or configuration. This bypasses the logging framework, making it impossible to suppress these messages when needed (e.g., in production environments where only errors or critical logs are required).
The print statements create inconsistency in log handling. For example, if the logging level is set to ERROR or CRITICAL, the info and warning logs should not be displayed. However, because of the print statements, these messages are still printed to the console, which defeats the purpose of setting a logging level.
Since the print statements duplicate the log messages, the same message appears twice: once from the print statement and once from the actual logger. This redundancy can clutter the console and log files, making it harder to read and analyze logs.
Expected behaviour
No response
Code to reproduce the issue
Log output
No response
The text was updated successfully, but these errors were encountered: