当前位置: 首页>>代码示例>>PHP>>正文


PHP Log::useFiles方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Log::useFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::useFiles方法的具体用法?PHP Log::useFiles怎么用?PHP Log::useFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Log的用法示例。


在下文中一共展示了Log::useFiles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     $viewLog = new Logger('View Logs');
     $viewLog->pushHandler(new StreamHandler(storage_path() . '/logs/laravel.log', Logger::INFO));
     if ($e instanceof ModelNotFoundException) {
         Log::useFiles(storage_path() . '/logs/laravel.log');
         $viewLog->addInfo('A 404 error (ModelNotFoundException) has been encountered, ' . 'details are as follows:\\n\\n' . $e->getMessage());
         Log::error('A 404 error (ModelNotFoundException) has been encountered, ' . 'details are as follows:\\n\\n' . $e->getMessage());
         abort(404);
     }
     if ($e instanceof ErrorException) {
         Log::useFiles(storage_path() . '/logs/laravel.log');
         $viewLog->addInfo('A 500 error (ErrorException) has been encountered, ' . 'details are as follows:\\n\\n' . $e->getMessage());
         Log::error('A 500 error (ErrorException) has been encountered, ' . 'details are as follows:\\n\\n' . $e->getMessage());
         abort(500);
     }
     return parent::render($request, $e);
 }
开发者ID:bitbitdecker,项目名称:bitcoin-faucet-rotator,代码行数:25,代码来源:Handler.php

示例2:

<?php

use Dingo\Api\Facade\API;
use Illuminate\Support\Facades\Log;
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
| is built on top of the wonderful Monolog library. By default we will
| build a basic log file setup which creates a single file for logs.
|
*/
Log::useFiles(storage_path() . '/logs/laravel.log');
/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
    Log::error($exception);
});
API::error(function (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
开发者ID:baa-archieve,项目名称:Cachet,代码行数:31,代码来源:global.php

示例3: useFiles

 static function useFiles($path)
 {
     Log::useFiles($path);
 }
开发者ID:noikiy,项目名称:turnt-octo-archer,代码行数:4,代码来源:Doc.php


注:本文中的Illuminate\Support\Facades\Log::useFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。