示例#1
0
 /**
  * Format data
  *
  * @param array $data
  * @param array $additional
  * @return type
  */
 protected function prepare(array $log, array $additional = [])
 {
     // integer, float, string or boolean as message
     $log = is_scalar($log) ? ['message' => $log] : $log;
     // resolve additonal properties from field providers
     $data = $this->fieldProvider->resolveValues($additional);
     $event = $data + $log;
     if (!isset($event['timestamp'])) {
         $event['timestamp'] = round(microtime(true) * 1000);
     }
     return $event;
 }
 /**
  * Register the Understand field provider
  *
  * @return void
  */
 protected function registerFieldProvider()
 {
     $this->app->bindShared('understand.field-provider', function ($app) {
         $fieldProvider = new FieldProvider();
         $fieldProvider->setSessionStore($app['session.store']);
         $fieldProvider->setRouter($app['router']);
         $fieldProvider->setRequest($app['request']);
         $fieldProvider->setEnvironment($app->environment());
         $fieldProvider->setTokenProvider($app['understand.token-provider']);
         return $fieldProvider;
     });
     $this->app->booting(function () {
         $loader = AliasLoader::getInstance();
         $loader->alias('UnderstandFieldProvider', 'Understand\\UnderstandLaravel\\Facades\\UnderstandFieldProvider');
     });
 }