進入到app/Mage.php
線785
public static function log($message, $level = null, $file = '', $forceLog = false)
你可以看到第二paramete是
水平
$level = is_null($level) ? Zend_Log::DEBUG : $level;
的lib \ Zend的\ log.php
const EMERG = 0; // Emergency: system is unusable
const ALERT = 1; // Alert: action must be taken immediately
const CRIT = 2; // Critical: critical conditions
const ERR = 3; // Error: error conditions
const WARN = 4; // Warning: warning conditions
const NOTICE = 5; // Notice: normal but significant condition
const INFO = 6; // Informational: informational messages
const DEBUG = 7; // Debug: debug messages
如果這個代碼Mage::log('test', 1);
然後你在日誌文件中的輸出這樣
2014-05-17T12:21:51+00:00 ALERT (1): test
是,該文件將自動由系統創建時其呼叫
系統包括打電話時的時間戳
在管線參閱該代碼在825個app/Mage.php
$format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
$formatter = new Zend_Log_Formatter_Simple($format);
乾杯
真棒解釋。謝謝 –
@Mark見我編輯的anwser –