Skip to content

Commit

Permalink
tweaks from feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 4, 2018
1 parent 549e162 commit a9fa1bf
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions src/Illuminate/Log/LogManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ protected function get($name)
});
} catch (Throwable $e) {
return tap($this->createEmergencyLogger(), function ($logger) use ($e) {
$logger->emergency('Unable to create configured logger. Using emergency logger.');

$logger->emergency($e);
$logger->emergency('Unable to create configured logger. Using emergency logger.', [
'exception' => $e,
]);
});
}
}
Expand Down Expand Up @@ -299,26 +299,6 @@ protected function formatter()
});
}

/**
* Monitor log messages and execute a callback if a message matches a given truth test.
*
* @param callable|string $watcher
* @param callable $callback
* @return void
*/
public function watch($watcher, $callback)
{
$watcher = is_callable($watcher) ? $watcher : function ($level, $message) use ($watcher) {
return Str::is($watcher, $message);
};

$this->app['events']->listen(MessageLogged::class, function ($event) use ($watcher, $callback) {
if ($watcher($event->level, $event->message, $event->context)) {
$callback($event->level, $event->message, $event->context);
}
});
}

/**
* Extract the log channel from the given configuration.
*
Expand Down

0 comments on commit a9fa1bf

Please sign in to comment.