Problem Statement
All handlers provided by monolog itself extend the abstract class \Monolog\Handler\Handler which has a destructor:
public function __destruct()
{
try {
$this->close();
} catch (\Throwable $e) {
// do nothing
}
}
This is in line with the comment on \Monolog\Logger::close() which states:
This is useful at the end of a request and will be called automatically on every handler when they get destructed.
This however is only true for all handler extending the abstract class. The LogsHandler does not which requires a manual call to the close() method to actually send the logs to sentry.
Solution Brainstorm
I think LogsHandler should either check if extending \Monolog\Handler\Handler is possible or of it should replicate it's __destruct() behavior.
Problem Statement
All handlers provided by monolog itself extend the abstract class
\Monolog\Handler\Handlerwhich has a destructor:This is in line with the comment on
\Monolog\Logger::close()which states:This however is only true for all handler extending the abstract class. The
LogsHandlerdoes not which requires a manual call to theclose()method to actually send the logs to sentry.Solution Brainstorm
I think
LogsHandlershould either check if extending\Monolog\Handler\Handleris possible or of it should replicate it's__destruct()behavior.