logging - How to disable laravel logs temporarily? -
i felt log recursion problem , disable logs single operation. there kind of runtime switch laravel logs? like:
<?php log::stop(); // bypass log here log::resume();
unfortunately, there no way through facade on example above. what's best way turn laravel log off temporarily?
here hacky way it. swap facade instance mock.
with mockery:
$app = log::getfacaderoot(); log::shouldreceive('error', 'warning', 'debug', 'info', 'notice', 'critical', 'alert', 'emergency'); // bypass log here log::swap($app);
without mockery:
class logmock { public function __call($name, $arguments) {} } $app = log::getfacaderoot(); log::swap(new logmock); // bypass log here log::swap($app);
Comments
Post a Comment