소스 검색

Monolog日志构建器

Zhouzhendong 4 년 전
부모
커밋
290a295cbc
4개의 변경된 파일17개의 추가작업 그리고 41개의 파일을 삭제
  1. 9 39
      app/Http/Controllers/TestController.php
  2. 3 0
      app/Logging/InfoFormatter.php
  3. 3 0
      app/Logging/WarningFormatter.php
  4. 2 2
      config/logging.php

+ 9 - 39
app/Http/Controllers/TestController.php

@@ -130,45 +130,15 @@ sql;
 
     public function test()
     {
-        Cache::forget("CACHE_SHELF_AVAILABLE");
-        $station = ["HAIB1-01-01"];
-        $material = ["IDE0000751"];
-        Station::query()->whereIn("code",$station)->update(["status"=>0]);
-        $stations = Station::query()->whereIn("code",$station)->get();
-        $materials = MaterialBox::query()->whereIn("code",$material)->get();
-        $dateTime = date("Y-m-d H:i:s");
-        $task1 = StationTaskMaterialBox::query()->create([
-            'station_id'=>$stations[0]->id,
-            'material_box_id'=>$materials[0]->id,
-            'station_task_batch_id'=>1,
-            'status'=>'待处理'
-        ]);
-        TaskTransaction::query()->insert([[
-            "doc_code" => "test",
-            "bar_code" => "test",
-            "to_station_id" => $stations[0]->id,
-            "material_box_id" => $materials[0]->id,
-            "task_id" => $task1->id,
-            "commodity_id" => 505012,//XUNI03
-            "amount" => 1,
-            "type" => "出库",
-            "status" => 0,
-            "mark" => 2,
-            "bin_number"=>1,
-            "created_at"=>$dateTime,
-            "updated_at"=>$dateTime,
-        ]]);
-        $foreignHaiRoboticsService = new ForeignHaiRoboticsService();
-        $toLocation = collect($station);
-        $taskMaterialBoxes = collect([$task1]);
-        $foreignHaiRoboticsService->
-        fetchGroup_multiLocation($toLocation, $taskMaterialBoxes, '', '立架出至缓存架',20,false);
-        foreach ($toLocation as $value){
-            app("CacheShelfService")->lightUp($value,'3','0',["title"=>"机器人取箱中,禁止操作"]);
-            Cache::forever("CACHE_SHELF_OCCUPANCY_11",true);
-        }
-        app("StationService")->locationOccupyMulti($toLocation->toArray());
-        dd(1);
+        \Illuminate\Support\Facades\Log::emergency("emergency");
+        \Illuminate\Support\Facades\Log::critical("critical");
+        \Illuminate\Support\Facades\Log::alert("alert");
+        \Illuminate\Support\Facades\Log::error("error");
+        \Illuminate\Support\Facades\Log::warning("warning");
+        \Illuminate\Support\Facades\Log::notice("notice");
+        \Illuminate\Support\Facades\Log::info("info");
+        \Illuminate\Support\Facades\Log::debug("debug");
+        $a = 0/0;
         /*$batchService = new BatchService();
         $batches = Batch::query()->where("id",171829)->get();
         $batchService->assignTasks($batches);

+ 3 - 0
app/Logging/InfoFormatter.php

@@ -11,5 +11,8 @@ namespace App\Logging;
  */
 class InfoFormatter
 {
+    public function __invoke($logger)
+    {
 
+    }
 }

+ 3 - 0
app/Logging/WarningFormatter.php

@@ -11,5 +11,8 @@ namespace App\Logging;
  */
 class WarningFormatter
 {
+    public function __invoke($logger)
+    {
 
+    }
 }

+ 2 - 2
config/logging.php

@@ -41,7 +41,7 @@ return [
     'channels' => [
         'stack' => [
             'driver' => 'stack',
-            'channels' => ["debug",'critical',"error","warning","info"],
+            'channels' => ['critical',"error","warning","info","debug"],
             'ignore_exceptions' => false,
         ],
         'single' => [
@@ -86,7 +86,7 @@ return [
             'driver' => 'single',
             'tap' => [App\Logging\WarningFormatter::class],
             'path' => storage_path('logs/warning.log'),
-            'level' => 'error',
+            'level' => 'warning',
             "bubble"=>false,
         ],
         'info'=>[