public
__construct
(mixed $message, mixed $priority = Log::INFO, mixed $category = '', mixed $date = null, array $context = array())
/**
* Constructor
*
* @param string $message The message to log.
* @param int $priority Message priority based on {$this->priorities}.
* @param string $category Type of entry
* @param string $date Date of entry (defaults to now if not specified or blank)
* @param array $context An optional array with additional message context.
*
* @since 1.7.0
* @change 3.10.7 If the message containes a full path, the root path (JPATH_ROOT) is removed from it
* to avoid any full path disclosure. Before 3.10.7, the path was propagated as provided.
*/
public function __construct($message, $priority = Log::INFO, $category = '', $date = null, array $context = array())
{
$this->message = Path::removeRoot((string) $message);
// Sanitize the priority.
if (!\in_array($priority, $this->priorities, true)) {
$priority = Log::INFO;
}
$this->priority = $priority;
$this->context = $context;
// Sanitize category if it exists.
if (!empty($category)) {
$this->category = (string) strtolower(preg_replace('/[^A-Z0-9_\\.-]/i', '', $category));
}
// Get the current call stack and back trace (without args to save memory).
$this->callStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
// Get the date as a Date object.
$this->date = new Date($date ?: 'now');
}