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


PHP Log::useFiles方法代码示例

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


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

示例1: __construct

 public function __construct($config = null)
 {
     ini_set('max_execution_time', 300);
     //var_dump($config["url"]);exit
     if (!$config) {
         $config = Config::get('api');
     }
     $this->logFile = base_path() . '/logs/sii-api.log';
     if (!is_array($config)) {
         throw new Exception("Error: no configuration for Sii");
     } elseif (!array_key_exists("url", $config)) {
         throw new Exception("Error: no url was found");
     } elseif (!array_key_exists("name", $config)) {
         throw new Exception("Error: No name for app was found");
     } elseif (!array_key_exists("password", $config)) {
         throw new Exception("Error: No password for app was found");
     } else {
         $this->url = $config["url"];
         $this->name = $config["name"];
         $this->password = $config["password"];
         $this->proxy = $config['proxy'];
         $curr_user = Session::get('user');
         $this->token = $curr_user['persona']['token'];
         //$this->client = new Buzz\Client\FileGetContents();
         $this->client = new Buzz\Client\Curl();
         $this->client->setTimeout(60);
         $this->response = new Buzz\Message\Response();
         Log::useFiles($this->logFile, App::environment('local', 'staging') ? 'debug' : 'critical');
     }
     //$this->client = $buzz;
 }
开发者ID:diegomjasso,项目名称:UPASystem2,代码行数:31,代码来源:sii.php

示例2: payment

 /**
  * Paypal cart payment ipn handler
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function payment()
 {
     try {
         \DB::beginTransaction();
         $listener = new Listener();
         $verifier = new SocketVerifier();
         // $ipn = \Input::all();
         $ipnMessage = Message::createFromGlobals();
         // uses php://input
         $verifier->setIpnMessage($ipnMessage);
         $verifier->setEnvironment(\Config::get('app.paypal_mode'));
         $listener->setVerifier($verifier);
         $listener->onVerifiedIpn(function () use($listener) {
             $ipn = [];
             $messages = $listener->getVerifier()->getIpnMessage();
             parse_str($messages, $ipn);
             if ($order = EloquentOrderRepository::find(\Input::get('custom'))) {
                 /**
                  * Check the paypal payment.
                  *
                  * Total sales ==  ipn['mc_gross']
                  *
                  * Driver Paypal Account == ipn['business]
                  */
                 if ($ipn['payment_status'] == 'Completed' && $order->total_sales == $ipn['payment_gross'] && $order->OrderDriver()->paypal_account == $ipn['business']) {
                     \Event::fire('paxifi.paypal.payment.' . $ipn['txn_type'], [$order->payment, $ipn]);
                     $products = $order->products;
                     $products->map(function ($product) {
                         // Fires an event to update the inventory.
                         \Event::fire('paxifi.product.ordered', array($product, $product['pivot']['quantity']));
                         // Fires an event to notification the driver that the product is in low inventory.
                         if (EloquentProductRepository::find($product->id)->inventory <= 5) {
                             \Event::fire('paxifi.notifications.stock', array($product));
                         }
                     });
                 }
                 \DB::commit();
             }
         });
         $listener->listen(function () use($listener) {
             $resp = $listener->getVerifier()->getVerificationResponse();
         }, function () use($listener) {
             // on invalid IPN (somethings not right!)
             $report = $listener->getReport();
             $resp = $listener->getVerifier()->getVerificationResponse();
             \Log::useFiles(storage_path() . '/logs/' . 'error-' . time() . '.txt');
             \Log::info($report);
             return $this->setStatusCode(400)->respondWithError('Payment failed.');
         });
     } catch (\RuntimeException $e) {
         return $this->setStatusCode(400)->respondWithError($e->getMessage());
     } catch (\Exception $e) {
         print_r($e->getMessage());
         return $this->errorInternalError();
     }
 }
开发者ID:xintang22,项目名称:Paxifi,代码行数:61,代码来源:PaypalController.php

示例3: testNotFoundRender

 public function testNotFoundRender()
 {
     $path = base_path('tests/storage/logs/report.log');
     \Log::useFiles($path);
     $exception = new \Illuminate\Database\Eloquent\ModelNotFoundException();
     $exception->setModel('Testing');
     $response = $this->handler->render($this->app['request'], $exception);
     $this->assertSame(404, $response->getStatusCode());
     $this->beforeApplicationDestroyed(function () use($path) {
         \File::delete($path);
     });
 }
开发者ID:laravel-jp-reference,项目名称:chapter8,代码行数:12,代码来源:HandlerTest.php

示例4: testBroadcastPartial

 /**
  * リスト6.33:makePartial を利用するパーシャルモック
  */
 public function testBroadcastPartial()
 {
     $broadcastLog = base_path('/tests/tmp/broadcast.log');
     \Log::useFiles($broadcastLog);
     $mock = \Mockery::mock(new \App\Publisher(new \Illuminate\Broadcasting\BroadcastManager($this->app)))->makePartial();
     $mock->shouldReceive('channel')->andReturn('laravel5.1');
     $mock->broadcast([]);
     $this->assertFileExists($broadcastLog);
     $this->beforeApplicationDestroyed(function () use($broadcastLog) {
         \File::delete($broadcastLog);
     });
 }
开发者ID:laravel-jp-reference,项目名称:chapter6,代码行数:15,代码来源:PublisherTest.php

示例5: testUserRegister

 public function testUserRegister()
 {
     $path = base_path('tests/storage/logs/user_register.log');
     \Log::useFiles($path);
     $user = $this->service->registerUser([]);
     $this->assertFileExists($path);
     $content = file_get_contents($path);
     $this->assertNotFalse(strpos($content, 'laravel-reference@example.com'));
     $this->assertNotFalse(strpos($content, 'ユーザー登録が完了しました'));
     $this->assertNotFalse(strpos($content, 'testing'));
     $this->beforeApplicationDestroyed(function () use($path) {
         \File::delete($path);
     });
 }
开发者ID:laravel-jp-reference,项目名称:chapter8,代码行数:14,代码来源:UserServiceTest.php

示例6: testPostUserRegister

 /**
  * ユーザー作成が行われることをテストします
  * ユーザー作成時に送信されるメールは、テストではログに出力されるように設定しています
  * 'phpunit.xml内の<env name="MAIL_DRIVER" value="log" />'
  */
 public function testPostUserRegister()
 {
     $this->registerTestLogger();
     $mailLog = base_path('/tests/storage/logs/mail.log');
     // ログで利用するファイルをtests配下に変更します
     \Log::useFiles($mailLog);
     $this->visit('/auth/register')->type('laravel5', 'name')->type('laravel-reference@example.com', 'email')->type('testing', 'password')->type('testing', 'password_confirmation')->type(session('captcha.phrase'), 'captcha_code')->press('アカウント作成');
     // ファイルが出力されたかどうかを確認します
     $this->assertFileExists($mailLog);
     // メールに記載されている内容をテストできます
     $this->assertNotFalse(strpos(file_get_contents($mailLog), 'laravel-reference@example.com'));
     // テスト終了時に行う処理を記述します
     $this->beforeApplicationDestroyed(function () use($mailLog) {
         // ログファイルの削除を行います
         \File::delete($mailLog);
     });
 }
开发者ID:laravel-jp-reference,项目名称:chapter8,代码行数:22,代码来源:FunctionalUserRegisterTest.php

示例7: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $filename = $this->argument('filename');
     if (!$this->option('web-importer')) {
         $logFile = $this->option('logfile');
         \Log::useFiles($logFile);
         if ($this->option('testrun')) {
             $this->comment('====== TEST ONLY Asset Import for ' . $filename . ' ====');
             $this->comment('============== NO DATA WILL BE WRITTEN ==============');
         } else {
             $this->comment('======= Importing Assets from ' . $filename . ' =========');
         }
     }
     if (!ini_get("auto_detect_line_endings")) {
         ini_set("auto_detect_line_endings", '1');
     }
     $csv = Reader::createFromPath($this->argument('filename'));
     $csv->setNewline("\r\n");
     $results = $csv->fetchAssoc();
     $newarray = null;
     foreach ($results as $index => $arraytoNormalize) {
         $internalnewarray = array_change_key_case($arraytoNormalize);
         $newarray[$index] = $internalnewarray;
     }
     $this->locations = Location::All(['name', 'id']);
     $this->categories = Category::All(['name', 'category_type', 'id']);
     $this->manufacturers = Manufacturer::All(['name', 'id']);
     $this->asset_models = AssetModel::All(['name', 'modelno', 'category_id', 'manufacturer_id', 'id']);
     $this->companies = Company::All(['name', 'id']);
     $this->status_labels = Statuslabel::All(['name', 'id']);
     $this->suppliers = Supplier::All(['name', 'id']);
     $this->assets = Asset::all(['asset_tag']);
     $this->accessories = Accessory::All(['name']);
     $this->consumables = Consumable::All(['name']);
     $this->customfields = CustomField::All(['name']);
     $bar = null;
     if (!$this->option('web-importer')) {
         $bar = $this->output->createProgressBar(count($newarray));
     }
     // Loop through the records
     DB::transaction(function () use(&$newarray, $bar) {
         Model::unguard();
         $item_type = strtolower($this->option('item-type'));
         foreach ($newarray as $row) {
             // Let's just map some of these entries to more user friendly words
             // Fetch general items here, fetch item type specific items in respective methods
             /** @var Asset, License, Accessory, or Consumable $item_type */
             $item_category = $this->array_smart_fetch($row, "category");
             $item_company_name = $this->array_smart_fetch($row, "company");
             $item_location = $this->array_smart_fetch($row, "location");
             $item_status_name = $this->array_smart_fetch($row, "status");
             $item["item_name"] = $this->array_smart_fetch($row, "item name");
             if ($this->array_smart_fetch($row, "purchase date") != '') {
                 $item["purchase_date"] = date("Y-m-d 00:00:01", strtotime($this->array_smart_fetch($row, "purchase date")));
             } else {
                 $item["purchase_date"] = null;
             }
             $item["purchase_cost"] = $this->array_smart_fetch($row, "purchase cost");
             $item["order_number"] = $this->array_smart_fetch($row, "order number");
             $item["notes"] = $this->array_smart_fetch($row, "notes");
             $item["quantity"] = $this->array_smart_fetch($row, "quantity");
             $item["requestable"] = $this->array_smart_fetch($row, "requestable");
             $item["asset_tag"] = $this->array_smart_fetch($row, "asset tag");
             $this->current_assetId = $item["item_name"];
             if ($item["asset_tag"] != '') {
                 $this->current_assetId = $item["asset_tag"];
             }
             $this->log('Category: ' . $item_category);
             $this->log('Location: ' . $item_location);
             $this->log('Purchase Date: ' . $item["purchase_date"]);
             $this->log('Purchase Cost: ' . $item["purchase_cost"]);
             $this->log('Company Name: ' . $item_company_name);
             $this->log('Status: ' . $item_status_name);
             $item["user"] = $this->createOrFetchUser($row);
             $item["location"] = $this->createOrFetchLocation($item_location);
             $item["category"] = $this->createOrFetchCategory($item_category, $item_type);
             $item["manufacturer"] = $this->createOrFetchManufacturer($row);
             $item["company"] = $this->createOrFetchCompany($item_company_name);
             $item["status_label"] = $this->createOrFetchStatusLabel($item_status_name);
             switch ($item_type) {
                 case "asset":
                     // -----------------------------
                     // CUSTOM FIELDS
                     // -----------------------------
                     // Loop through custom fields in the database and see if we have any matches in the CSV
                     foreach ($this->customfields as $customfield) {
                         if ($item['custom_fields'][$customfield->db_column_name()] = $this->array_smart_custom_field_fetch($row, $customfield)) {
                             $this->log('Custom Field ' . $customfield->name . ': ' . $this->array_smart_custom_field_fetch($row, $customfield));
                         }
                     }
                     $this->createAssetIfNotExists($row, $item);
                     break;
                 case "accessory":
                     $this->createAccessoryIfNotExists($item);
                     break;
//.........这里部分代码省略.........
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:101,代码来源:ObjectImportCommand.php

示例8: date

| your classes in the "global" namespace without Composer updating.
|
*/
// PSR-4のため不要なものを削除
\ClassLoader::addDirectories([app_path() . '/database/seeds']);
/*
|--------------------------------------------------------------------------
| 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' . date("Ymd") . '.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);
    return \Response::view('error', []);
开发者ID:k-kurikuri,项目名称:Laravel.JpRecipe,代码行数:31,代码来源:global.php

示例9:

|
| Here we are binding the paths configured in paths.php to the app. You
| should not be changing these here. If you need to change these you
| may do so within the paths.php file and they will be bound here.
|
*/
$app->bindInstallPaths(require __DIR__ . '/paths.php');
/*
|--------------------------------------------------------------------------
| Load The Application
|--------------------------------------------------------------------------
|
| Here we will load this Illuminate application. We will keep this in a
| separate location so we can isolate the creation of an application
| from the actual running of the application with a given request.
|
*/
$framework = $app['path.base'] . '/vendor/laravel/framework/src';
require $framework . '/Illuminate/Foundation/start.php';
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
Log::useFiles('php://stdout', 'info');
return $app;
开发者ID:6174,项目名称:phphub,代码行数:31,代码来源:start.php

示例10: app_path

| your classes in the "global" namespace without Composer updating.
|
*/
ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/libraries', app_path() . '/database/seeds'));
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$logFile = 'solderlog-' . date('Y-m-d') . '.txt';
Log::useFiles(storage_path() . '/logs/' . $logFile);
/*
|--------------------------------------------------------------------------
| 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);
    if (!Config::get('app.debug') && !App::runningInConsole()) {
开发者ID:GoatEli,项目名称:TechnicSolder,代码行数:31,代码来源:global.php

示例11: app_path

| load your controllers and models. This is useful for keeping all of
| your classes in the "global" namespace without Composer updating.
|
*/
ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds'));
/*
|--------------------------------------------------------------------------
| 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/system.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);
});
开发者ID:tamboer,项目名称:LaravelOctober,代码行数:31,代码来源:global.php

示例12: app_path

| load your controllers and models. This is useful for keeping all of
| your classes in the "global" namespace without Composer updating.
|
*/
ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/database/seeds'));
/*
|--------------------------------------------------------------------------
| 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/app.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);
});
开发者ID:brseixas,项目名称:laravel-bootstrap-bower-gulp,代码行数:31,代码来源:global.php

示例13: end

DB::listen(function($sql, $bindings, $times) {
    $queries = DB::getQueryLog();
    $last_query = end($queries);
    
    Log::useFiles(storage_path() . '/logs/ropc_log_query.log', 'alert');
    Log::alert('', array('user' => Session::get('usuario.username'),
        ',proceso' => Session::get('proceso'),
        ',host' => Config::get('database.connections.oracle.host'),
        ',bd' => DB::getDatabaseName(),
        ',service_name' => Config::get('database.connections.oracle.service_name'),
        ',consulta' => $last_query,
        ',times' => $times
    ));
});
*/
/* * ************* GUARDAR LOG DE ERRORES*************** */
App::error(function (Exception $exc, $code) {
    Log::useFiles(storage_path() . '/logs/ropc_log_error.log', 'error');
    Log::error('', array('user' => Session::get('usuario.username'), ',proceso' => Session::get('proceso'), ',Error' => $exc->getMessage(), ',Tracer' => $exc->getTraceAsString(), ',code' => $code));
});
/*
 |--------------------------------------------------------------------------
 | Require The Filters File
 |--------------------------------------------------------------------------
 |
 | Next we will load the filters file for the application. This gives us
 | a nice separate location to store our route and application filter
 | definitions instead of putting them all in the main routes file.
 |
*/
require app_path() . '/filters.php';
开发者ID:albornozcabrera,项目名称:ra,代码行数:31,代码来源:global.php

示例14: app_path

| your classes in the "global" namespace without Composer updating.
|
*/
ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds'));
/*
|--------------------------------------------------------------------------
| 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');
Log::useFiles('php://stderr');
/*
|--------------------------------------------------------------------------
| 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);
});
开发者ID:jpalala,项目名称:LaravelPH-Website,代码行数:31,代码来源:global.php

示例15: app_path

ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds'));
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$mytime = Carbon\Carbon::now();
$year = $mytime->year;
$month = $mytime->month;
$day = $mytime->day;
Log::useFiles(storage_path() . '/logs/logqlm_' . $year . $month . $day . '.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);
});
开发者ID:ndmson,项目名称:Trade,代码行数:31,代码来源:global.php


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