zoukankan      html  css  js  c++  java
  • CI 日志类

    开发ci的过程中,使用log能直观的看出代码运行到哪,还可设置代码查看数据接口的发送情况。日志类:

    <?php defined('BASEPATH') OR exit('No direct script access allowed');
    /**
     * Logging Class
     */
    class MY_Log extends CI_Log {
    
        public function info()
        {
            $msg = preg_replace("#
    ?
    #", '', implode('', func_get_args()));
            return $this->write_log('INFO', $msg, FALSE);
        }
    
        public function error()
        {
            $msg = preg_replace("#
    ?
    #", '', implode('', func_get_args()));
            return $this->write_log('ERROR', $msg, FALSE);
        }
    
        public function debug()
        {
            $msg = preg_replace("#
    ?
    #", '', implode('', func_get_args()));
            return $this->write_log('DEBUG', $msg, FALSE);
        }
    }
    // END MY_Log Class
    
    /* End of file MY_Log.php */
    /* Location: ./application/libraries/MY_Log.php */

    使用方法:

    1. 自动加载log类: $autoload['libraries'] = array('log', 'session', 'curl', 'memcache');

    2.输出log类:可在log文件中查看

     $this->log->debug('[GBOMP] 用户[' . $user . ']使用密码[' . $pass . ']尝试登录结果为:[' . print_r($info, TRUE) . ']');

  • 相关阅读:
    算法提高 12-1三角形
    poj3723_Conscription
    算法提高 8-1因式分解
    算法提高 道路和航路
    算法训练 安慰奶牛
    最短路问题(Bellman/Dijkstra/Floyd)
    最小生成树 prime+heap
    算法训练 最短路
    算法训练 最大的算式
    poj3255 Roadblocks
  • 原文地址:https://www.cnblogs.com/webskill/p/4962362.html
Copyright © 2011-2022 走看看