/** * initializes this writer with the provided configuration. * @param Configuration $config the configuration provided to this writer. * @see WriterAbstract::init() */ public function init(Configuration $config) { //check to see if the config contains a set useMinErrorLevel and that its a boolean value. $this->useMinErrorLevel = $config->get('useMinErrorLevel', true); //check to see if the minErrorLevel is set and that its a level instance and useMinErrorLevel is true. $this->minErrorLevel = $config->get('minErrorLevel', Level::error(), function ($level) { return $level instanceof Level; }); //check that the user provided a valid target stream. $this->target = $config->get('target', self::STDOUT, function ($target) { return isset($target) && in_array($target, array(self::STDOUT, self::STDERR, self::OUTPUT)); }); $this->getLayoutConfig()->set('pattern', $this->pattern, true); //set the layout for this writer. $this->setLayout(new Pattern()); }
/** * Helper function to log a message at the error log level. * @param string $message the message to log. * @param array $extras [optional] the array of extra variables to pass to this * single log entry. to this single log entry to this single log entry. * @return void */ public function error($message, $extras = array()) { $this->log(Level::error(), $message, $extras); }