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
I'd like to use an error logger (like Monolog) to log errors. So it would be great if the output parameter accepted a callable argument (like closure).
The text was updated successfully, but these errors were encountered:
I'd find this useful too. I've looked at the source code and I think the major issue is serialization. The callable would need to be serialized (not an issue as the library already has a dependency on the superclosure library), but so would any dependency of the callable. Taking Monolog for example, a StreamHandler cannot be serialized.
The only thing I can think of at the moment is to add an interface like Psr3LoggerFactory that the callable has to return. e.g
`output` => function () {
returnnewclassimplements Psr3LoggerFactory {
publicfunctioncreateLogger(): LoggerInterface {
// return a PSR3 logger, e.g. Monolog
}
}
}
Then background job would do something like
if (is_callable($config["output"])) {
$logger = $config["output"]();
} else {
// log to file
}
I'd like to use an error logger (like Monolog) to log errors. So it would be great if the
output
parameter accepted a callable argument (like closure).The text was updated successfully, but these errors were encountered: