/** * Constructor - initializes the filter. * @param array $config the configuration for this filter. */ public function init(Configuration $config) { $this->levelToMatch = $config->get('levelToMatch', null, function ($levelToMatch) { return $levelToMatch instanceof Level; }); $this->acceptOnMatch = $config->get('acceptOnMatch', true); }
/** * Constructor - initializes the pattern and set the required variables. * @param array $config the configutation for this writer. */ public function init(Configuration $config) { $this->fileLocation = $config->get('file', ''); $this->append = $config->get('append', true); $this->locking = $config->get('locking', true); $this->getLayoutConfig()->set('pattern', $this->pattern, true); $this->setLayout(new Pattern()); }
/** * Constructor - initializes the filter. * @param array $config the configuration for this filter. */ public function init(Configuration $config) { $this->levelMin = $config->get('levelMin', Level::trace(), function ($levelMin) { return $levelMin instanceof Level; }); $this->levelMax = $config->get('levelMax', Level::fatal(), function ($levelMax) { return $levelMax instanceof Level; }); $this->acceptOnMatch = $config->get('acceptOnMatch', true); }
/** * 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()); }
/** * Constructor - initializes the database connection. * * @param array $config the configuration for this writer. * * for this writer to work we need a dsn, a username, password and a table name. */ public function init(Configuration $config) { if (!isset($config['tableName']) || strlen($config['tableName']) == 0) { throw new \Exception('table name is required'); } $this->tableName = $config['tableName']; $this->dsn = $config->get('dsn', ''); $this->username = $config->get('username', ''); $this->password = $config->get('password', ''); $this->insertStatement = $config->get('insertStatement', $this->insertStatement); try { $this->connection = new \PDO($this->dsn, $this->username, $this->password); $this->connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); } catch (\PDOException $e) { throw new \Exception('could not connect to database instance: ' . $e->getMessage()); } $this->insertStatement = str_replace(':table:', $this->tableName, $this->insertStatement); $this->getLayoutConfig()->set('pattern', $this->pattern, true); $this->setLayout(new Bind()); }
/** * Constructor - initializes the filter. * @param array $config the configuration for this filter. */ public function init(Configuration $config) { $this->className = $config->get('class', null); $this->className = isset($this->className) ? trim($this->className, ' \\') : null; $this->acceptOnMatch = $config->get('acceptOnMatch', true); }
/** * Constructor - initializes the filter. * @param array $config the configuration for this filter. */ public function init(Configuration $config) { $this->function = $config->get('function', null); $this->function = isset($this->function) ? trim($this->function, ' \\') : null; $this->acceptOnMatch = $config->get('acceptOnMatch', true); }