Esempio n. 1
0
 /**
  * Define a callback to be used to configure Monolog.
  *
  * @param callable $callback
  * @return $this 
  * @static 
  */
 public static function configureMonologUsing($callback)
 {
     return \Illuminate\Foundation\Application::configureMonologUsing($callback);
 }
 /**
  * @param string                 $basePath The application base path
  * @param ProvidesCapsulePattern $pattern  The capsule pattern
  *
  * @return \Illuminate\Foundation\Application
  */
 protected function bootstrapPattern($basePath, $pattern)
 {
     //  Get the app's autoloader
     /** @noinspection PhpIncludeInspection */
     require Disk::path([$basePath, 'vendor', 'autoload.php']);
     //  Create the application
     $_app = new Application($basePath);
     $_app->useEnvironmentPath($basePath);
     foreach ($pattern as $_abstract => $_concrete) {
         $_app->singleton($_abstract, $_concrete);
     }
     //  Set up logging
     $_app->configureMonologUsing(function (Logger $monolog) {
         $_logFile = Disk::path([env('DFE_CAPSULE_LOG_PATH', storage_path('logs')), $this->instanceId . '.log']);
         $_handler = new StreamHandler($_logFile);
         $_handler->setFormatter(new LineFormatter(null, null, true, true));
         $monolog->pushHandler($_handler);
     });
     $this->basePath = $basePath;
     return $this->app = $_app;
 }