Hello people,
I am the developer of the official snips plugin, glad to be with you all to discuss.
I actually met a very strange problem with Log function from the very beginning. But still I did not solve it.
The problem is: even I called log::add(‹ snips ›, ‹ info ›, ‹ Message xxxx ›); Nothing happened or logged under snips section.
This is a bit test I have done:
I tried to use scenario code to simulate a log::add call:
And I added a few lines of the code in log.class just to have more information:
public static function add($_log, $_type, $_message, $_logicalId = ''){
fwrite(STDOUT, '[Logger] Entered\n');
fwrite(STDOUT, '[Logger] Message:'. $_message .'\n');
fwrite(STDOUT, '[Logger] Loger:'. $_log .'\n');
if (trim($_message) == '') {
return;
}
$logger = self::getLogger($_log);
$action = 'add' . ucwords(strtolower($_type));
if (method_exists($logger, $action)) {
fwrite(STDOUT, '[Logger] Logger exist\n');
$logger->$action($_message);
try {
$level = Logger::toMonologLevel($_type);
if ($level == Logger::ERROR && self::getConfig('addMessageForErrorLog') == 1) {
@message::add($_log, $_message, '', $_logicalId);
} elseif ($level > Logger::ALERT) {
@message::add($_log, $_message, '', $_logicalId);
}
} catch (Exception $e) {
fwrite(STDOUT, '[Logger ERROR]'.$e->getMessage().'\n');
}
}
}
After execute this scenario, I have:
But still, nothing under snips is changed…
I hope you guys can help me figure out the problem. Thanks in advance.