loggerclasstest.php

来自「Professional PHP5 code for this book」· PHP 代码 · 共 27 行

PHP
27
字号
<?phprequire_once('class.Logger.php');$cfg['LOGGER_FILE'] = '/var/log/myapplication.log';$cfg['LOGGER_LEVEL'] = LOGGER_INFO;$log = Logger::getInstance();if(isset($_GET['fooid'])) {    //not written to the log - the log level is too high  $log->logMessage('A fooid is present', LOGGER_DEBUG);    //LOG_INFO is the default so this would get printed  $log->logMessage('The value of fooid is ' .  $_GET['fooid']);  } else {    //This will also be written, and includes a module name  $log->logMessage('No fooid passed from ' . $_SERVER['HTTP_REFERER'],                    LOGGER_CRITICAL,                   "Foo Module");    throw new Exception('No foo id!');}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?