php记录日志

WBOY
Release: 2016-06-23 14:31:14
Original
1160 people have browsed it

简介:这是php记录日志的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=343151' scrolling='no'>

  $ss_log_level = 0;   $ss_log_filename = /tmp/ss-log;   $ss_log_levels = array(       NONE => 0,       ERROR => 1,       INFO => 2,       DEBUG => 3   );    //设置日志级别  function ss_log_set_level ($level = ERROR) {       global $ss_log_level;       $ss_log_level = $level;   }    //记录日志
Copy after login
   function ss_log ($level, $message) { 
Copy after login
      global $ss_log_level, $ss-log-filename;       if ($ss_log_levels[$ss_log_level] < $ss_log_levels[$level]) {           // 不显示Log信息           return false;       }       $fd = fopen($ss_log_filename, "a+");       fputs($fd, $level. - [.ss_times*****p_pretty().] - .$message."n");       fclose($fd);       return true;  }   //清空日志  function ss_log_reset () {       global $ss_log_filename;       @unlink($ss_log_filename);   } 
Copy after login

  

//调用示例ss_log_set_level(INFO); ss_log(ERROR, "testing level ERROR"); ss_log(INFO, "testing level INFO"); ss_log(DEBUG, "testing level DEBUG"); ss_log_reset(); 
Copy after login

  

  

爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

http://biancheng.dnbcw.info/php/343151.html pageNo:5
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template