className = $className; } protected function log_notice($any, $msg = '', $tag = 'log_notice') { if ($any instanceof ErrorException || $any instanceof Exception) { $str = c_formate_exception($any); } else { $str = json_encode($any, JSON_UNESCAPED_UNICODE); } Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . $str . ']', 'NOTICE'); } protected function log_warn($any, $msg = '', $tag = 'log_warn') { if ($any instanceof ErrorException || $any instanceof Exception) { $str = c_formate_exception($any); } else { $str = json_encode($any, JSON_UNESCAPED_UNICODE); } Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . ']', 'WARN'); } protected function log_error($any, $msg = '', $tag = 'log_error') { if ($any instanceof ErrorException || $any instanceof Exception) { $str = c_formate_exception($any); } else { $str = json_encode($any, JSON_UNESCAPED_UNICODE); } Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . ']', 'ERROR'); } protected function alarm($type = '', $content = '') { D('alarm')->insert([ 'type' => $type, 'content' => $content, 'create_time' => c_now(), ]); } }