Browse Source

Use injection here. Blah, can't decide.

Taylor Otwell 10 years ago
parent
commit
45f0b4f9d9
2 changed files with 12 additions and 7 deletions
  1. 8 4
      app/Providers/ErrorServiceProvider.php
  2. 4 3
      app/Providers/LogServiceProvider.php

+ 8 - 4
app/Providers/ErrorServiceProvider.php

@@ -1,16 +1,20 @@
 <?php namespace App\Providers;
 
-use App, Log, Exception;
+use Exception;
+use Illuminate\Contracts\Logging\Log;
 use Illuminate\Support\ServiceProvider;
+use Illuminate\Contracts\Exception\Handler;
 
 class ErrorServiceProvider extends ServiceProvider {
 
 	/**
 	 * Register any error handlers.
 	 *
+	 * @param  Handler  $handler
+	 * @param  Log  $log
 	 * @return void
 	 */
-	public function boot()
+	public function boot(Handler $handler, Log $log)
 	{
 		// Here you may handle any errors that occur in your application, including
 		// logging them or displaying custom views for specific errors. You may
@@ -18,9 +22,9 @@ class ErrorServiceProvider extends ServiceProvider {
 		// exceptions. If nothing is returned, the default error view is
 		// shown, which includes a detailed stack trace during debug.
 
-		App::error(function(Exception $e)
+		$handler->error(function(Exception $e) use ($log)
 		{
-			Log::error($e);
+			$log->error($e);
 		});
 	}
 

+ 4 - 3
app/Providers/LogServiceProvider.php

@@ -1,6 +1,6 @@
 <?php namespace App\Providers;
 
-use Log;
+use Illuminate\Contracts\Logging\Log;
 use Illuminate\Support\ServiceProvider;
 
 class LogServiceProvider extends ServiceProvider {
@@ -8,11 +8,12 @@ class LogServiceProvider extends ServiceProvider {
 	/**
 	 * Configure the application's logging facilities.
 	 *
+	 * @param  Log  $log
 	 * @return void
 	 */
-	public function boot()
+	public function boot(Log $log)
 	{
-		Log::useFiles(storage_path().'/logs/laravel.log');
+		$log->useFiles(storage_path().'/logs/laravel.log');
 	}
 
 	/**