當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Log\Writer類代碼示例

本文整理匯總了PHP中Illuminate\Log\Writer的典型用法代碼示例。如果您正苦於以下問題:PHP Writer類的具體用法?PHP Writer怎麽用?PHP Writer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Writer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setupListener

 /**
  * setting up listener
  *
  * @param Dispatcher $events
  * @param Writer $log
  */
 private function setupListener(Dispatcher $events, Writer $log)
 {
     $environments = config('slow-query-logger.environments', []);
     if (!$this->app->environment($environments)) {
         return;
     }
     $events->listen(QueryExecuted::class, function (QueryExecuted $queryExecuted) use($log) {
         $sql = $queryExecuted->sql;
         $bindings = $queryExecuted->bindings;
         $time = $queryExecuted->time;
         $logSqlQueriesSlowerThan = config('slow-query-logger.time-to-log');
         if ($logSqlQueriesSlowerThan < 0 || $time < $logSqlQueriesSlowerThan) {
             return;
         }
         $level = config('slow-query-logger.log-level', 'debug');
         try {
             foreach ($bindings as $val) {
                 $sql = preg_replace('/\\?/', "'{$val}'", $sql, 1);
             }
             $log->log($level, $time . '  ' . $sql);
         } catch (\Exception $e) {
             //  be quiet on error
         }
     });
 }
開發者ID:rokde,項目名稱:laravel-slow-query-logger,代碼行數:31,代碼來源:LaravelSlowQueryLoggerProvider.php

示例2: configureHandlers

 /**
  * Custom Monolog handler that for Logentries.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @param  \Illuminate\Log\Writer  $log
  * @return void
  */
 protected function configureHandlers(Application $app, Writer $log)
 {
     $logger = $log->getMonolog();
     $logfile_handler = new StreamHandler(storage_path() . '/logs/laravel.log');
     $logger->pushHandler($logfile_handler);
     $logger->pushProcessor(new \Monolog\Processor\MemoryUsageProcessor());
     $logger->pushProcessor(new \Monolog\Processor\MemoryPeakUsageProcessor());
     $logger->pushProcessor(new \Monolog\Processor\WebProcessor());
 }
開發者ID:ambarsetyawan,項目名稱:brewski,代碼行數:16,代碼來源:ConfigureLogging.php

示例3: configureSeparateWriter

 /**
  * Configures log writer for logging to files separately from the application.
  *
  * @param Writer $writer
  */
 protected function configureSeparateWriter(Writer $writer)
 {
     $path = 'logs/' . ltrim($this->getCore()->config('log.file', 'cms'), '/');
     if ($this->getCore()->config('log.daily')) {
         $writer->useDailyFiles(storage_path($path), (int) $this->getCore()->config('log.max_files'));
     }
     foreach ($writer->getMonolog()->getHandlers() as $handler) {
         $handler->setLevel($this->getCore()->config('log.threshold'));
     }
 }
開發者ID:czim,項目名稱:laravel-cms-core,代碼行數:15,代碼來源:LogServiceProvider.php

示例4: configureHandlers

 /**
  * Configure the Monolog handlers for the application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @param  \Illuminate\Log\Writer  $log
  * @return void
  */
 protected function configureHandlers(Application $app, Writer $log)
 {
     // Stream handlers
     $logPath = $app->storagePath() . '/logs/app.log';
     $logLevel = Monolog::INFO;
     $logStreamHandler = new StreamHandler($logPath, $logLevel);
     // push handlers
     $logger = $log->getMonolog();
     $logger->pushHandler($logStreamHandler);
 }
開發者ID:Kenneth058,項目名稱:adminclubinnova,代碼行數:17,代碼來源:ConfigureLogging.php

示例5: configureSingleHandler

 /**
  * Configure the Monolog handlers for the application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @param  \Illuminate\Log\Writer  $log
  * @return void
  */
 protected function configureSingleHandler(Application $app, Writer $log)
 {
     $syslogHandler = new SyslogHandler(env('LOG_PREFIX', 'BasketLog'), LOG_USER, LOG_NOTICE);
     $logger = $log->getMonolog();
     if (env('LOG_SYSLOG', false)) {
         $logger->pushHandler($syslogHandler);
     }
     if (env('LOG_FILE', false)) {
         $streamHandler = new StreamHandler(storage_path('logs/laravel.log'), LOG_NOTICE);
         $logger->pushHandler($streamHandler);
     }
 }
開發者ID:paybreak,項目名稱:basket,代碼行數:19,代碼來源:ConfigureLogging.php

示例6: loger

 function loger($level, $file, $line, $string, $ar = NULL)
 {
     // если системный level ниже notice, то при включеном KINT_DUMP, ставим уровень notice
     if ($GLOBALS['KINT_DUMP'] && $this->agiconfig['verbosity_level'] < 2) {
         $this->agiconfig['verbosity_level'] = 2;
     }
     if ($this->agiconfig['verbosity_level'] < $level) {
         return;
     }
     if ($GLOBALS['KINT_DUMP']) {
         ~d("{$level} | {$file} | {$line}");
         if (!is_null($string)) {
             d($string);
         }
         if (!is_null($ar)) {
             d($ar);
         }
         return;
     }
     if (!is_null($string)) {
         $this->agi->verbose($string);
     }
     if (!is_null($ar)) {
         $this->agi->verbose($ar);
     }
     if ((int) $this->agiconfig['logging_write_file'] === 1) {
         $logger = new Writer(new Logger('local'));
         $logger->useFiles($this->config['logs_patch']);
         if (!is_null($ar)) {
             $string .= "\n";
             $string .= var_export($string, true);
         }
         switch ($level) {
             case 'error':
                 $logger->error("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'warning':
                 $logger->warning("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'notice':
                 $logger->notice("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'info':
                 $logger->info("[" . $this->uniqueid . "] [{$file}] [{$line}]:  {$string}");
                 break;
             default:
                 $logger->debug("[" . $this->uniqueid . "] [{$file}] [{$line}]: {$string}");
                 break;
         }
     }
 }
開發者ID:regroute,項目名稱:rr20-backend,代碼行數:51,代碼來源:Rr.php

示例7: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $logger = new Writer(new Monolog($app->environment()), $app['events']);
     // Daily files are better for production stuff
     $logger->useDailyFiles(storage_path('/logs/laravel.log'));
     $app->instance('log', $logger);
     // Next we will bind the a Closure to resolve the PSR logger implementation
     // as this will grant us the ability to be interoperable with many other
     // libraries which are able to utilize the PSR standardized interface.
     $app->bind('Psr\\Log\\LoggerInterface', function ($app) {
         return $app['log']->getMonolog();
     });
     $app->bind('Illuminate\\Contracts\\Logging\\Log', function ($app) {
         return $app['log'];
     });
 }
開發者ID:bitbitdecker,項目名稱:bitcoin-faucet-rotator,代碼行數:22,代碼來源:ConfigureLogging.php

示例8: execute

 /**
  * @param DomainListener $listener
  * @return mixed
  */
 public function execute(DomainListener $listener)
 {
     $user = $this->auth->user();
     $domains = $this->repository->listOfDomains($user->id);
     $this->log->info('Show Domains');
     return $listener->view('domains.index', compact('domains'));
 }
開發者ID:codeboard,項目名稱:gitmanagement,代碼行數:11,代碼來源:ListOfDomains.php

示例9: execute

 /**
  * @param $domainId
  * @param DomainListener $listener
  * @return mixed
  */
 public function execute($domainId, DomainListener $listener)
 {
     $domain = $this->repository->getDomainById($domainId);
     $sshKey = $this->getPublicKey();
     $this->log->info('Show Domain id ' . $domainId, $domain->toArray());
     return $listener->view('domains.show', compact('domain', 'sshKey'));
 }
開發者ID:codeboard,項目名稱:gitmanagement,代碼行數:12,代碼來源:ShowDomain.php

示例10: execute

 /**
  * Execute the required command against the command handler.
  *
  * @param Command $command
  * @return mixed
  */
 public function execute(Command $command)
 {
     $handler = $this->commandTranslator->getCommandHandler($command);
     $commandName = $this->getCommandName($command);
     $this->log->info("New command [{$commandName}]", get_object_vars($command));
     return $this->app->make($handler)->handle($command);
 }
開發者ID:tectonic,項目名稱:application-support,代碼行數:13,代碼來源:DefaultCommandBus.php

示例11: storeSupervisordConfig

 /**
  * Stores The SupervisorD configuration
  *
  * @param $worker
  */
 private function storeSupervisordConfig($worker)
 {
     $domain = Domain::findOrFail($worker->domain_id);
     $file = view('configuration.supervisord', compact('worker', 'domain'))->render();
     File::put(Config::get('settings.supervisord_location') . '/worker-' . $worker->id . '.log', $file);
     $this->log->info('Supervisord Config created');
 }
開發者ID:codeboard,項目名稱:gitmanagement,代碼行數:12,代碼來源:AddNewWorker.php

示例12: dispatch

 /**
  * @param array $events
  */
 public function dispatch(array $events)
 {
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->event->fire($eventName, $event);
         $this->log->info("{$eventName} was fired.");
     }
 }
開發者ID:adamgoose,項目名稱:commander,代碼行數:11,代碼來源:EventDispatcher.php

示例13: dispatch

 /**
  * Dispatches the array of events, firing off the appropriate event name for each and logging the event fired.
  *
  * @param array $events
  */
 public function dispatch(array $events)
 {
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->log->info("New event [{$eventName}]", get_object_vars($event));
         $this->event->fire($eventName, $event);
     }
 }
開發者ID:tectonic,項目名稱:application-support,代碼行數:13,代碼來源:EventDispatcher.php

示例14: api

 /**
  * @return mixed
  */
 public function api()
 {
     $args = func_get_args();
     if (self::$laravelDebug === true) {
         $this->laravelLog->info('Facebook Api Call: ' . print_r($args, 1));
     }
     return call_user_func_array("parent::api", $args);
 }
開發者ID:pageboost,項目名稱:facebook-laravel,代碼行數:11,代碼來源:LaravelFacebook.php

示例15: execute

 public function execute($domainId, $envData, EnvironmentsListener $listener)
 {
     if (empty($envData['environment'])) {
         $envData['environment'] = 'production';
     }
     $environment = $this->repository->addEnvironment($domainId, $envData);
     $this->log->info('Environment variable added', $environment->toArray());
     return $listener->environmentRedirect($environment);
 }
開發者ID:codeboard,項目名稱:gitmanagement,代碼行數:9,代碼來源:AddEnvironment.php


注:本文中的Illuminate\Log\Writer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。