public ___log ( string $str = '', array $options = [] ) : WireLog | null | ||
$str | string | Text to log, or omit to just return the name of the log |
$options | array | Optional extras to include: - url (string): URL to record the with the log entry (default=auto-detect) - name (string): Name of log to use (default=auto-detect) |
Résultat | WireLog | null |
public function ___log($str = '', array $options = array())
{
$log = $this->wire('log');
if ($log && strlen($str)) {
if (isset($options['name'])) {
$name = $options['name'];
unset($options['name']);
} else {
$name = $this->className(array('lowercase' => true));
}
$log->save($name, $str, $options);
}
return $log;
}
/** * Save to pages activity log, if enabled in config * * @param $str * @param Page|null Page to log * @return WireLog * */ public function log($str, Page $page) { if (!in_array('pages', $this->wire('config')->logs)) { return parent::___log(); } if ($this->wire('process') != 'ProcessPageEdit') { $str .= " [From URL: " . $this->wire('input')->url() . "]"; } $options = array('name' => 'pages', 'url' => $page->path); return parent::___log($str, $options); }