且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

法师日志(magento)中null的含义是什么?

更新时间:2023-12-01 19:44:22

转到app/Mage.php

第785行

public static function log($message, $level = null, $file = '', $forceLog = false) 

您可以看到第二个参数是水平

you can see the second paramete is level

$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);

然后您将在日志文件中得到这样的输出

then you get a output in log file like this

2014-05-17T12:21:51+00:00 ALERT (1): test

是的,文件在调用时由系统自动创建

系统在调用时包括时间戳记

在825行的app/Mage.php中引用此代码

refer this code in app/Mage.php in line 825

 $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
 $formatter = new Zend_Log_Formatter_Simple($format);

欢呼