CI Source (a)-log, log

Source: Internet
Author: User

The log module of CI is implemented and used as a library.
(a) How to use
(a) configuration in applicatin/environment/config/config.php
    • Log_threshold: Writable log level thresholds. Array (' ERROR ' = ' 1 ', ' DEBUG ' = ' 2 ', ' INFO ' = ' 3 ', ' all ' = ' 4 '). Levels that are less than or equal to the threshold can be written. With this evironment, different levels of logging can be recorded in different environments, such as development environment record all level, testing logging to debug level, production environment record error level
    • Log_path: Log file root directory, default is Application/logs, must ensure that directory has write permission
    • Log_date_format: Date format in daily log

(b) There is only one way to invoke the call log
    • $this->log->write_log ($level = ' error ', $msg)


(ii) Modalities of implementation
(a) library/log.php
    • Write_log ($level = ' error ', $msg, $php _error = FALSE): Determines whether the log can be written according to the log level



(iii) Advantages and disadvantages
(a) shortcomings
    • The threshold configuration restricts the writing of dead logs, such as in the production environment, and can only write to the error level log, even if you want to temporarily add some debug-level log. Here I have expanded a Write_log_force method myself. Calling this method, the threshold is first tuned to the all level, then the log is written, and the threshold level is finally restored. Address Https://github.com/wkupaochuan/analysis-about-ci-frame.git, in application/library/my_log.php



CI Framework Source Analysis Address Https://github.com/wkupaochuan/analysis-about-ci-frame.git

CI Source (a)-log, log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.