自定义日志记录方法

    /**
     * [log 记录执行日志] 
     * @param  [type] $str   [description]
     * @param  [type] $count [description]
     * @return [type]        [description]
     */
    public function log($str,$count)
    {
        $date = date('Y-m-d H:i:s');
        $text = '-------------------------------------------------------------------'.PHP_EOL;

        if ($count > 0) {
            $text .= "|🐉[  {$str},时间:{$date},row:{$count}  ]🐉|".PHP_EOL;
        }else{
            $text .= "|🐍[  {$str},时间:{$date},row:{$count}  ]🐍|".PHP_EOL;
        }
        $dir = RUNTIME_PATH.'Timing';
        if (!is_dir($dir)) {
            mkdir($dir);
        }
        
        $file_name = $dir.'/Timing_'.date('Y_m_d').'.log';
        file_put_contents($file_name,$text,FILE_APPEND);
    }

添加新评论