PHP code example of ofix / panda-log

1. Go to this page and download the library: Download ofix/panda-log library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ofix / panda-log example snippets


composer 
 
  'bootstrap' => ['panda-log'],
  $config['modules']['panda-log'] = [
      'class' => ofix\PandaLog\Module::class,
      'log_dir'=> '@backend/runtime/panda-log/', // log_dir is the directory panda-log files located on
  ];

 // log string
 $str = "test for string";
 Panda::log("str",$str);
 // log sql
 $sql = (new Query())->select("some_table")->where(["id"=>4032]);
 Panda::log("sql",$sql);
 // log number
 $num = 323;
 Panda::log("num",$num);
 // log object
 $student = new \stdClass();
 $student->name = "tom";
 $student->age = 28;
 Panda::log("student",$student);
 // log array
 $arr = ["id"=>3223,"mobile"=>13993434];
 Panda::log("arr",$arr);
 
 //flush all above records to log file please call following code,otherwise it would not save in files.
 Panda::flush();