Message is saved to a log file in ProcessWire's logs path to a file with
the same name as the class, converted to hyphenated lowercase.
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 |
/** * 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); }
/** * Save to activity log, if enabled in config * * @param $str * @param Saveable|null Item to log * @return WireLog * */ public function log($str, Saveable $item = null) { $logs = $this->wire('config')->logs; $name = $this->className(array('lowercase' => true)); if ($logs && in_array($name, $logs)) { if ($item && strpos($str, "'{$item->name}'") === false) { $str .= " '{$item->name}'"; } return parent::___log($str, array('name' => $name)); } return parent::___log(); }