protected function doWrite(array $event) { $this->logEntity = new Entity\UserActivity(); $this->logEntity->setMessage($event['message']); $this->logEntity->setUser($event['extra']['user']); $this->entityManager->persist($this->logEntity); $this->entityManager->flush(); }
public function __construct($config = array()) { $config = Hash::merge($this->_defaults, $config); if (is_null($this->logger)) { $this->logger = FluentLogger::open($config['host'], $config['port']); } parent::__construct($config); }
/** * Constructs a new Sentry Logger. * * Config * * - `server` string, url of the Sentry server [default: Configure::read('Sentry.PHP.server')] * - `clientOptions` array, Options to pass to the CakeRavenClient constructor * * @param array $options Options for the SentryLog, see above. */ public function __construct($config = array()) { $config = Hash::merge(array('server' => Configure::read('Sentry.PHP.server'), 'clientOptions' => array('auto_log_stacks' => true)), $config); parent::__construct($config); if (Configure::read('debug') == 0 || !Configure::read('Sentry.production_only')) { Raven_Autoloader::register(); $this->__client = new CakeRavenClient($this->_config['server'], $this->_config['clientOptions']); } }
/** * Configures this logger stream * * @param array $config * @return array */ public function config($config = array()) { if (empty($config)) { return parent::config(); } if (!isset($config['timeout'])) { $config['timeout'] = 5; } return parent::config($config); }
/** * Constructs a new File Logger. * * Config * * - `types` string or array, levels the engine is interested in * - `scopes` string or array, scopes the engine is interested in * - `file` log file name * - `path` the path to save logs on. * * @param array $options Options for the FileLog, see above. */ public function __construct($config = array()) { parent::__construct($config); $config = Hash::merge(array('path' => LOGS, 'file' => null, 'types' => null, 'scopes' => array()), $this->_config); $config = $this->config($config); $this->_path = $config['path']; $this->_file = $config['file']; if (!empty($this->_file) && !preg_match('/\\.log$/', $this->_file)) { $this->_file .= '.log'; } }
public function __construct($config = array()) { parent::__construct(array_merge($this->defaults, $config)); extract($this->_config); if (!class_exists('Monolog\\Logger')) { $this->includeMonolog(); } $this->log = new Logger($channel); $this->__push($this->log, $handlers); $this->__push($this->log, $processors, 'Processor'); }
/** * Constructs a new Console Logger. * * Config * * - `types` string or array, levels the engine is interested in * - `scopes` string or array, scopes the engine is interested in * - `stream` the path to save logs on. * - `outputAs` integer or ConsoleOutput::[RAW|PLAIN|COLOR] * * @param array $config * Options for the FileLog, see above. * @throws CakeLogException */ public function __construct($config = array()) { parent::__construct($config); $config = Hash::merge(array('stream' => 'php://stderr', 'types' => null, 'scopes' => array(), 'outputAs' => ConsoleOutput::COLOR), $this->_config); $config = $this->config($config); if ($config['stream'] instanceof ConsoleOutput) { $this->_output = $config['stream']; } elseif (is_string($config['stream'])) { $this->_output = new ConsoleOutput($config['stream']); } else { throw new CakeLogException('`stream` not a ConsoleOutput nor string'); } $this->_output->outputAs($config['outputAs']); }
/** * Constructs a new File Logger. * * Config * * - `types` string or array, levels the engine is interested in * - `scopes` string or array, scopes the engine is interested in * - `file` log file name * - `path` the path to save logs on. * * @param array $options Options for the FileLog, see above. */ public function __construct($config = array()) { parent::__construct($config); $config = Hash::merge(array( 'path' => LOGS, 'file' => null, 'types' => null, 'scopes' => array(), ), $this->_config); $config = $this->config($config); $this->_path = $config['path']; $this->_file = $config['file']; if (!empty($this->_file) && substr($this->_file, -4) !== '.log') { $this->_file .= '.log'; } }
/** * Constructs a new Console Logger. * * Config * * - `types` string or array, levels the engine is interested in * - `scopes` string or array, scopes the engine is interested in * - `stream` the path to save logs on. * - `outputAs` integer or ConsoleOutput::[RAW|PLAIN|COLOR] * * @param array $config Options for the FileLog, see above. * @throws CakeLogException */ public function __construct($config = array()) { parent::__construct($config); if (DS === '\\' && !(bool) env('ANSICON') && env('ConEmuANSI') !== 'ON' || function_exists('posix_isatty') && !posix_isatty($this->_output)) { $outputAs = ConsoleOutput::PLAIN; } else { $outputAs = ConsoleOutput::COLOR; } $config = Hash::merge(array('stream' => 'php://stderr', 'types' => null, 'scopes' => array(), 'outputAs' => $outputAs), $this->_config); $config = $this->config($config); if ($config['stream'] instanceof ConsoleOutput) { $this->_output = $config['stream']; } elseif (is_string($config['stream'])) { $this->_output = new ConsoleOutput($config['stream']); } else { throw new CakeLogException('`stream` not a ConsoleOutput nor string'); } $this->_output->outputAs($config['outputAs']); }
/** * Sets protected properties based on config provided * * @param array $config Engine configuration * @return array */ public function config($config = array()) { parent::config($config); if (!empty($config['path'])) { $this->_path = $config['path']; } if (Configure::read('debug') && !is_dir($this->_path)) { mkdir($this->_path, 0775, true); } if (!empty($config['file'])) { $this->_file = $config['file']; if (substr($this->_file, -4) !== '.log') { $this->_file .= '.log'; } } if (!empty($config['size'])) { if (is_numeric($config['size'])) { $this->_size = (int) $config['size']; } else { $this->_size = CakeNumber::fromReadableSize($config['size']); } } return $this->_config; }
/** * Returns the static model of the specified AR class. * @return Log the static model class */ public static function model($className = __CLASS__) { return parent::model($className); }
/** * Make sure the configuration contains the format parameter, by default it uses * the error number and the type as a prefix to the message * * @param array $config */ public function __construct($config = array()) { $config += $this->_defaults; parent::__construct($config); }
/** * Returns a peer instance associated with this om. * * Since Peer classes are not to have any instance attributes, this method returns the * same instance for all member of this class. The method could therefore * be static, but this would prevent one from overriding the behavior. * * @return LogPeer */ public function getPeer() { if (self::$peer === null) { self::$peer = new LogPeer(); } return self::$peer; }
public function save(PropelPDO $con = null) { $this->setSfGuardUserProfileId(1); parent::save($con); }