Open vikramsubramanian opened 6 months ago
Based on the provided information, the issue seems to be related to the custom Coralogix handler not being recognized as a valid sink by Loguru due to the absence of a write
method or an issue with the severity levels. To resolve the issue:
CoralogixHandler
class has a write
method that is compatible with Loguru's expectations. This method should take a single argument (the log message) and handle the logging appropriately.Coralogix.Severity
attribute contains all the severity levels that Loguru might use (e.g., TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL).CoralogixHandler
is intended to be used with Loguru, it should be compatible with the logging.Handler
interface, which includes having a write
method.CoralogixHandler
is missing the write
method, add it to the class definition:class CoralogixHandler(logging.Handler):
# ... other methods ...
def write(self, message):
# Implementation for writing log messages
pass
write
method exists but is not being recognized, ensure that it is callable and that there are no typos or other issues preventing Loguru from detecting it.Coralogix.Severity
attribute has all the necessary severity levels defined and that they are accessible with the hasattr
check in the __getattr__
method. If any severity levels are missing, add them to the Coralogix.Severity
class.By ensuring that the CoralogixHandler
has a write
method and that all severity levels are defined and accessible, the issue should be resolved.
Hi, first of all, I love using loguru.
recently I needed to add another logger to my code called Coralogix , here's the [documnetation]( and here's the [source code ]( when I try to use
logger.add(coralogix_handler, level=logging.INFO, colorize=False)
I hit an exception originating from the coralogix handler
Severity name is invalid!
when I debug this, I see that it happens on this line (loguru)
elif hasattr(sink, "write") and callable(sink.write):
leading to [this line]( (coralogix_handler)can you please advice what should I do ? )