/** * Constructor. * * @param Doozr_Datetime_Service $datetime Datetime Service of Doozr * @param int $level Loglevel of the logging extending this class * @param string $fingerprint Fingerprint of the client * * @author Benjamin Carl <*****@*****.**> * * @return \Doozr_Logging_File */ public function __construct(Doozr_Datetime_Service $datetime, $level = null, $fingerprint = null) { // call parents constructor parent::__construct($datetime, $level, $fingerprint); // get registry $registry = Doozr_Registry::getInstance(); // store path-manager $this->setPath($registry->path); // set logfile-name (+path) $this->setLogfile($_SERVER['PHP_SELF']); // set filesystem service $this->setFilesystem(Doozr_Loader_Serviceloader::load('filesystem')); }
/** * Constructor. * * @param Doozr_Datetime_Service $datetime * @param int $level The loglevel of the logging extending this class * @param string $fingerprint The fingerprint of the client * * @internal param Doozr_Configuration $configuration The configuration instance * * @author Benjamin Carl <*****@*****.**> * @return \Doozr_Logging_Debugbar * @access public */ public function __construct(Doozr_Datetime_Service $datetime, $level = null, $fingerprint = null) { // Call parents constructor parent::__construct($datetime, $level, $fingerprint); }
/** * Dispatches a passed message and all arguments to attached loggers. * * @param string $type The level/type of the log entry * @param string $message The message to log * @param array $context The context with variables used for interpolation * @param string $time The time to use for logging * @param string $fingerprint The fingerprint to use/set * @param string $separator The separator to use/set * * @author Benjamin Carl <*****@*****.**> * * @return bool TRUE on success, otherwise FALSE */ public function log($type, $message, array $context = [], $time = null, $fingerprint = null, $separator = null) { // call parents log just as normal => so content, raw ... gets filled parent::log($type, $message, $context, $time, $fingerprint, $separator); // log date time $time = $time !== null ? $time : $this->date . ' [' . $this->dateTime->getMicrotimeDiff($_SERVER['REQUEST_TIME']) . ']'; // Store message in archive for e.g. debug bar and similar outputs $this->archive(sha1($message . $type . $fingerprint), ['type' => $type, 'message' => $message, 'context' => $context, 'time' => $time, 'fingerprint' => $fingerprint, 'separator' => $separator]); // and now the tricky hook -> notify all observers about the log-event $this->notify('log'); // return always success return true; }