Exemplo n.º 1
0
 /**
  * @param $log_path
  * @return ZendLogger
  */
 public static function getLogger($log_path)
 {
     if (!self::$logger) {
         #region ディレクトリ生成
         $date = date('Ym');
         $error_dir = $log_path . 'error/' . $date . '/';
         $info_dir = $log_path . 'info/' . $date . '/';
         if (!file_exists($error_dir)) {
             @mkdir($error_dir, 0777);
         }
         if (!file_exists($info_dir)) {
             @mkdir($info_dir, 0777);
         }
         #endregion
         #region log初期設定
         $logger = new ZendLogger();
         $writer_err = new Stream($error_dir . date('Y-m-d') . '.log');
         $writer_info = new Stream($info_dir . date('Y-m-d') . '.log');
         //エラーログの出力レベル変更
         $filter = new Priority(ZendLogger::WARN);
         $writer_err->addFilter($filter);
         $logger->addWriter($writer_err);
         $logger->addWriter($writer_info);
         #endregion
         self::$logger = $logger;
     }
     return self::$logger;
 }
Exemplo n.º 2
0
 /**
  * @param       $sFile
  * @param array $aOptions
  *
  * @return mixed
  */
 protected function _getLogger($sFile, array $aOptions = [])
 {
     $sKey = md5($sFile);
     if (!isset($this->_aLoggers[$sKey])) {
         $aWriterConfig = $this->_aConfig['writer'];
         $oLogger = new Logger($aOptions);
         if (isset($aWriterConfig['file']['enabled']) && $aWriterConfig['file']['enabled']) {
             $oFileWriter = $this->_getFileWriter($sFile);
             if (is_object($oFileWriter)) {
                 $oLogger->addWriter($oFileWriter);
             }
         }
         if (isset($aWriterConfig['mail']['enabled']) && $aWriterConfig['mail']['enabled']) {
             $oMailWriter = $this->_getMailWriter();
             if (is_object($oMailWriter)) {
                 $oLogger->addWriter($oMailWriter);
             }
         }
         if (isset($aWriterConfig['graylog']['enabled']) && $aWriterConfig['graylog']['enabled']) {
             $oGraylogWriter = $this->_getGraylogWriter($sFile);
             if (is_object($oGraylogWriter)) {
                 $oLogger->addWriter($oGraylogWriter);
             }
         }
         $this->_aLoggers[$sKey] = $oLogger;
     }
     return $this->_aLoggers[$sKey];
 }
Exemplo n.º 3
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->stream = fopen('php://temp', 'r+');
     $this->log = new Logger();
     $this->log->addWriter(new Stream($this->stream));
     $this->adapter = new Zf2LogAdapter($this->log);
 }
Exemplo n.º 4
0
 public function setUp()
 {
     $this->writer = new \Zend\Log\Writer\Mock();
     $this->logger = new \Zend\Log\Logger();
     $this->logger->addWriter($this->writer);
     $this->instance = new Response($this->logger);
 }
Exemplo n.º 5
0
 /**
  *
  */
 protected function createLogger()
 {
     $dirname = dirname($this->logFile);
     if (!is_dir($dirname)) {
         mkdir($dirname, 0755, true);
     }
     $this->logger = new Logger();
     $this->logger->addWriter(new Stream($this->logFile));
 }
Exemplo n.º 6
0
 /**
  * Init logging.
  *
  * @return void
  */
 public function initLogging()
 {
     $writer = new Stream('php://output');
     $this->logger = new Logger();
     $this->logger->addWriter($writer);
     $writer = new Stream('php://stderr');
     $this->errLogger = new Logger();
     $this->errLogger->addWriter($writer);
 }
Exemplo n.º 7
0
 public function __construct(array $config, HttpClient $client)
 {
     $this->config = $config;
     $this->http = $client;
     // create file logger
     $this->logger = new Logger();
     $writer = new WriterStream(ROOT . '/data/log/wechat.log');
     $this->logger->addWriter($writer);
     $this->wechatUtil = new WechatUtil($this->logger, array('token' => $this->config['token'], 'encodingaeskey' => $this->config['EncodingAESKey'], 'appid' => $this->config['appid'], 'appsecret' => $this->config['secret'], 'logcallback' => $this->logger));
 }
Exemplo n.º 8
0
 /**
  * @param \Zend\ServiceManager\ServiceLocatorInterface $sl
  * @return \Zend\Log\Logger
  */
 public function createService(ServiceLocatorInterface $sl)
 {
     if (!$this->logger) {
         // Log to file
         $this->logger = new \Zend\Log\Logger();
         $writer = new \Zend\Log\Writer\Stream('logs/all.log');
         $this->logger->addWriter($writer);
         \Zend\Log\Logger::registerErrorHandler($this->logger, true);
     }
     return $this->logger;
 }
Exemplo n.º 9
0
 protected function setUp()
 {
     $message = new MailMessage();
     $transport = new Transport\File();
     $options = new Transport\FileOptions(array('path' => __DIR__, 'callback' => function (Transport\File $transport) {
         return MailTest::FILENAME;
     }));
     $transport->setOptions($options);
     $this->writer = new MailWriter($message, $transport);
     $this->log = new Logger();
     $this->log->addWriter($this->writer);
 }
Exemplo n.º 10
0
 public function __construct(ModuleOptions $options, ServiceLocatorInterface $serviceLocator)
 {
     $this->options = $options;
     $this->serviceLocator = $serviceLocator;
     if ($this->options->getLogDir()) {
         $dirPath = $this->getLogDirPath($this->options->getLogDir());
         $this->logger = new Logger();
         $writer = new Stream($dirPath . '/mail.log');
         $this->logger->addWriter($writer);
         if (null !== $this->uMask) {
             umask($this->uMask);
         }
     }
 }
Exemplo n.º 11
0
 /**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     // create new logger
     $logger = new Logger();
     // get application config as array
     $config = $serviceLocator->get('config');
     $config = $config['dherrorlogging'];
     // get priority
     $priority = Logger::WARN;
     if (isset($config['priority']) && is_int($config['priority'])) {
         $priority = $config['priority'];
     }
     $priorityFilter = new Filter\Priority($priority);
     // get writers from config
     if (!empty($config['log_writers']) && is_array($config['log_writers'])) {
         $logWriterManager = $serviceLocator->get('LogWriterManager');
         foreach ($config['log_writers'] as $writerSpecs) {
             // skip if no name
             if (empty($writerSpecs['name']) || !is_string($writerSpecs['name'])) {
                 continue;
             }
             // get options
             $options = array();
             if (!empty($writerSpecs['options']) && is_array($writerSpecs['options'])) {
                 $options = $writerSpecs['options'];
             }
             // check if it is one of the known writers that can be created via config or retrieved from service manager
             if ($logWriterManager->has($writerSpecs['name'])) {
                 $writer = $logWriterManager->get($writerSpecs['name'], $options);
                 // add priority filter
                 $writer->addFilter($priorityFilter);
                 // add writer to logger
                 $logger->addWriter($writer);
             }
         }
     }
     // add processors which will add some extra helpful info (IP, URI, trace,..) to the final log.
     $processor = $serviceLocator->get('LogProcessorManager')->get('DhErrorLogging\\LoggerProcessor');
     $logger->addProcessor($processor);
     // Logger needs at least one writer. Check if there are any, else add empty one.
     if ($logger->getWriters()->count() == 0) {
         // Support for PHP7 / Zend >= 2.4
         if (class_exists('\\Zend\\Log\\Writer\\Noop')) {
             $logger->addWriter(new Writer\Noop());
         } else {
             $logger->addWriter(new Writer\Null());
         }
     }
     return $logger;
 }
Exemplo n.º 12
0
 public function onBootstrap(MvcEvent $e)
 {
     $events = StaticEventManager::getInstance();
     $serviceManager = $e->getApplication()->getServiceManager();
     $appConfig = $serviceManager->get('Config');
     $logger = new Logger();
     if (!isset($appConfig['operation_logger'])) {
         throw new \RuntimeException("Logger not properly configured");
     }
     if (!isset($appConfig['operation_logger']['priority_filter'])) {
         throw new \RuntimeException("You must specify a 'priority_filter' config param");
     }
     $logFilter = new PriorityFilter($appConfig['operation_logger']['priority_filter']);
     if (!is_null($appConfig['operation_logger']['db_adapter'])) {
         if (empty($appConfig['operation_logger']['logger_table'])) {
             throw new \RuntimeException("You must specify a 'logger_table' config param");
         }
         $dbAdapter = $serviceManager->get($appConfig['operation_logger']['db_adapter']);
         if (!$dbAdapter instanceof \Zend\Db\Adapter\Adapter) {
             throw new \RuntimeException("Failed to load database adapter for logger");
         }
         $tableMapping = array('timestamp' => 'event_date', 'priorityName' => 'priority', 'message' => 'event', 'extra' => array('id_operation_log' => 'id_operation_log', 'note' => 'note', 'table' => 'table_name', 'id_user' => 'id_user', 'username' => 'username', 'id_row' => 'id_row', 'field' => 'field', 'value_old' => 'value_old', 'value_new' => 'value_new', 'source' => 'source', 'uri' => 'uri', 'ip' => 'ip', 'session_id' => 'session_id'));
         $logWriter = new DbWriter($dbAdapter, $appConfig['operation_logger']['logger_table'], $tableMapping);
         $logWriter->addFilter($logFilter);
         $logger->addWriter($logWriter);
     }
     // nel caso si volgia fare un file LOG
     if (isset($appConfig['operation_logger']['log_file']) && !is_null($appConfig['operation_logger']['log_file'])) {
         $streamWriter = new StreamWriter($appConfig['operation_logger']['log_file']);
         $streamWriter->addFilter($logFilter);
         $logger->addWriter($streamWriter);
     }
     $request = $e->getApplication()->getRequest();
     $remoteAddress = new RemoteAddress();
     Logger::registerErrorHandler($logger, true);
     Logger::registerExceptionHandler($logger);
     // Attacco evento per trigger LOG! (evento: operation-log)
     $events->attach("*", 'operation-log', function (\Zend\EventManager\Event $e) use($logger, $request, $remoteAddress, $serviceManager) {
         $targetClass = get_class($e->getTarget());
         $message = $e->getParam('message');
         $priority = $e->getParam('priority', Logger::INFO);
         $zfcAuthEvents = $serviceManager->get('zfcuser_auth_service');
         $idUser = $zfcAuthEvents->hasIdentity() ? $zfcAuthEvents->getIdentity()->getId() : (array_key_exists('id_user', $message) ? $message['id_user'] : '******');
         $displayName = $zfcAuthEvents->hasIdentity() ? $zfcAuthEvents->getIdentity()->getDisplayName() : (array_key_exists('username', $message) ? $message['username'] : '******');
         $extras = array('id_operation_log' => null, 'note' => array_key_exists('note', $message) ? $message['note'] : null, 'table_name' => array_key_exists('table', $message) ? $message['table'] : null, 'operation' => array_key_exists('operation', $message) ? $message['operation'] : null, 'id_user' => $idUser, 'username' => $displayName, 'id_row' => array_key_exists('id_row', $message) ? $message['id_row'] : null, 'field' => array_key_exists('field', $message) ? $message['field'] : null, 'value_old' => array_key_exists('value_old', $message) ? $message['value_old'] : null, 'value_new' => array_key_exists('value_new', $message) ? $message['value_new'] : null, 'source' => $targetClass, 'uri' => $request->getUriString(), 'ip' => $remoteAddress->getIpAddress(), 'session_id' => session_id());
         $logger->log($priority, $message['message'], $extras);
     });
 }
Exemplo n.º 13
0
 public static function generateFileLogger($logFile, $logDir)
 {
     $fileName = static::validateLogFile($logFile, $logDir);
     $zendLogLogger = new Logger();
     $zendLogLogger->addWriter(new Stream($fileName));
     return new PsrLoggerAdapter($zendLogLogger);
 }
Exemplo n.º 14
0
 /**
  * Create the NewRelic logger
  *
  * @param  ServiceLocatorInterface $serviceLocator
  * @return Logger
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $logger = new Logger();
     $writer = $serviceLocator->get('NewRelic\\Log\\Writer');
     $logger->addWriter($writer);
     return $logger;
 }
Exemplo n.º 15
0
 /**
  * Provide instance
  *
  * @return CacheAdapter
  */
 public function get()
 {
     $logger = new Logger();
     $writer = new Stream($this->logDir . '/app.log');
     $logger->addWriter($writer);
     return new Zf2LogAdapter($logger);
 }
Exemplo n.º 16
0
 public function __construct()
 {
     $configFile = __DIR__ . '/../config.yml';
     $value = Yaml::parse(file_get_contents($configFile));
     $ariAddress = $value['examples']['client']['ari_address'];
     $dialString = $value['examples']['dial_example']['dial_string'];
     $logger = new Log\Logger();
     $logWriter = new Log\Writer\Stream("php://output");
     $logger->addWriter($logWriter);
     //$filter = new \Zend\Log\Filter\SuppressFilter(true);
     $filter = new Log\Filter\Priority(Log\Logger::NOTICE);
     $logWriter->addFilter($filter);
     // Connect to the ARI server
     $this->client = new Phparia($logger);
     $this->client->connect($ariAddress);
     $this->client->getAriClient()->onConnect(function () use($dialString) {
         try {
             $this->client->channels()->createChannel($dialString, null, null, null, null, $this->client->getStasisApplicationName(), 'dialed', '8185551212', 30, null, null, array('MYVARIABLE' => 'value'));
         } catch (ServerException $e) {
             $this->log($e->getMessage());
         }
     });
     // Listen for the stasis start
     $this->client->onStasisStart(function (StasisStart $event) use($dialString) {
         if (count($event->getArgs()) > 0 && $event->getArgs()[0] === 'dialed') {
             $this->log('Detected outgoing call with variable MYVARIABLE=' . $event->getChannel()->getVariable('MYVARIABLE')->getValue());
             // Put the new channel in a bridge
             $channel = $event->getChannel();
             $this->bridge = $this->client->bridges()->createBridge(uniqid(), 'dtmf_events, mixing', 'dial_example_bridge');
             $this->bridge->addChannel($channel->getId());
         }
     });
     $this->client->run();
 }
Exemplo n.º 17
0
 /**
  * Prepare Logger service
  * 
  * 
  * @uses Logger
  * 
  * @access public
  * @param ServiceLocatorInterface $serviceLocator
  * @return Logger
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $logger = new Logger();
     $writer = new Stream(self::ERROR_LOG_FILE);
     $logger->addWriter($writer);
     return $logger;
 }
Exemplo n.º 18
0
 /**
  * Metoda inicializira crpalka service(cs) predno se začne cs uporabljat
  * 
  * @param ServiceLocatorInterface $serviceLocator
  * @return \Crpalka\Service\CrpalkaService
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     //pridobitev configuracije
     $options = $serviceLocator->get('Config');
     //parsanje potrebnih podatkov
     $poti = $options['crpalka']['pravila']['pot'];
     $owningSide = $options['crpalka']['pravila']['owningside'];
     $NeOwningSide = $options['crpalka']['pravila']['neowningside'];
     $ident = $options['crpalka']['pravila']['ident'];
     $service = new CrpalkaService();
     //inicializacija propertijev
     $service->setEmIzvor($serviceLocator->get("doctrine.entitymanager.orm_default"));
     $service->setEmCilj($serviceLocator->get("doctrine.entitymanager.orm_dest"));
     $service->setEntityMetadataFactory($serviceLocator->get("entity.metadata.factory"));
     $service->setPoljeEntitet(new ArrayCollection());
     $service->setPoljePravil(new ArrayCollection($poti));
     $service->setPoljeOwningSide(new ArrayCollection($owningSide));
     $service->setPoljeNeOwningSide(new ArrayCollection($NeOwningSide));
     $service->setPoljeIdent(new ArrayCollection($ident));
     //deklaracija in inicializacija loggerja
     $logger = new Logger();
     $log = __DIR__ . '/../../../../../data/crpalka.log';
     $writer = new Writer\Stream($log);
     $logger->addWriter($writer);
     $logger->registerErrorHandler($logger);
     $service->setLogger($logger);
     return $service;
 }
Exemplo n.º 19
0
 public function logInfo($message)
 {
     $log = new Logger();
     $writer = new Stream('pronoi.log');
     $log->addWriter($writer);
     $log->log(Logger::INFO, $message);
 }
Exemplo n.º 20
0
 /**
  * Init profiler
  */
 public function initProfiler(MvcEvent $e)
 {
     try {
         $writer = new FirePhp();
         $logger = new Logger();
         $logger->addWriter($writer);
         $logger->info('memory usage: ' . memory_get_usage(true) / 1024 / 1024 . 'Mb');
         $logger->info('page execution time: ' . (microtime(true) - APPLICATION_START));
         // get sql profiler
         if (null !== ($sqlProfiler = $this->serviceLocator->get('Zend\\Db\\Adapter\\Adapter')->getProfiler())) {
             $queriesTotalTime = 0;
             foreach ($sqlProfiler->getProfiles() as $query) {
                 $base = ['time' => $query['elapse'], 'query' => $query['sql']];
                 $queriesTotalTime += $query['elapse'];
                 if (!empty($query['parameters'])) {
                     $params = [];
                     foreach ($query['parameters'] as $key => $value) {
                         $params[$key] = $value;
                     }
                     $base['params'] = $params;
                 }
                 $logger->info('', $base);
             }
             $logger->info('sql queries total execution time: ' . $queriesTotalTime);
         }
     } catch (Exception $e) {
         ApplicationErrorLogger::log($e);
     }
 }
Exemplo n.º 21
0
 public function __construct($config)
 {
     $this->config = $config;
     if (isset($this->config['log_dir'])) {
         if (!is_dir($this->config['log_dir'])) {
             try {
                 mkdir($this->config['log_dir']);
             } catch (Exception $exc) {
                 echo "<h1>Could not create log directory " . $this->config['log_dir'] . "</h1>";
                 echo $exc->getMessage();
             }
         }
     } else {
         $this->config['log_dir'] = "/tmp/ldap";
         if (!is_dir($this->config['log_dir'])) {
             try {
                 mkdir($this->config['log_dir']);
             } catch (Exception $exc) {
                 echo "<h1>Could not create log directory " . $this->config['log_dir'] . "</h1>";
                 echo $exc->getMessage();
             }
         }
     }
     $logger = new Logger();
     $writer = new LogWriter($config['log_dir'] . '/ldap.log');
     $logger->addWriter($writer);
     Logger::registerErrorHandler($logger);
     $this->logger = $logger;
     $this->logger->log(Logger::INFO, 'Starting LDAP Bind');
     $this->bind();
 }
Exemplo n.º 22
0
 /**
  *
  * @author VanCK
  * @param ServiceLocatorInterface $sl
  * @return \Zend\Cache\StorageFactory
  */
 public function createService(ServiceLocatorInterface $sl)
 {
     $log = new Logger();
     $writer = new FirePhpWriter();
     $log->addWriter($writer);
     return $log;
 }
Exemplo n.º 23
0
 public function __construct()
 {
     $configFile = __DIR__ . '/../config.yml';
     $value = Yaml::parse(file_get_contents($configFile));
     $ariAddress = $value['examples']['client']['ari_address'];
     $amiAddress = $value['examples']['client']['ami_address'];
     $logger = new Log\Logger();
     $logWriter = new Log\Writer\Stream("php://output");
     $logger->addWriter($logWriter);
     //$filter = new Log\Filter\SuppressFilter(true);
     $filter = new Log\Filter\Priority(Log\Logger::NOTICE);
     $logWriter->addFilter($filter);
     // Connect to the ARI server
     $client = new Phparia($logger);
     $client->connect($ariAddress, $amiAddress);
     $this->client = $client;
     // Listen for the stasis start
     $client->onStasisStart(function (StasisStart $event) {
         // Put the new channel in a bridge
         $channel = $event->getChannel();
         $bridge = $this->client->bridges()->createBridge(uniqid(), 'dtmf_events, mixing', 'bridgename');
         $this->client->bridges()->addChannel($bridge->getId(), $channel->getId());
         // Listen for DTMF and hangup when '#' is pressed
         $channel->onChannelDtmfReceived(function (ChannelDtmfReceived $event) use($channel) {
             $this->log("Got digit: {$event->getDigit()}");
             if ($event->getDigit() === '#') {
                 $channel->hangup();
             }
         });
         $this->client->getWsClient()->on('Hangup', function ($event) {
             $this->log('User hung up');
         });
     });
     $this->client->run();
 }
 /**
  * __construct(array $config) basic connect to primary socket
  * @param array $config @see module.config.php
  * @access public
  * @return boolean
  * @throws Exception\ExceptionStrategy
  */
 public function __construct(array $config)
 {
     if (empty($config)) {
         throw new Exception\ExceptionStrategy('Required parameters are incorrupted!');
     }
     $this->config = $config;
     // pre define response server errors
     if (true === $this->isWindows()) {
         self::$error = new \WebSockets\Status\WinSocketErrors();
     } else {
         self::$error = new \WebSockets\Status\UnixSocketErrors();
     }
     // check if loging service is available
     if (true === $this->config['log']) {
         // add log writer
         if (null === $this->_logger) {
             if (!file_exists($this->config['logfile'])) {
                 throw new Exception\ExceptionStrategy("Error! File {$this->config['logfile']} does not exist");
             }
             $this->__log = true;
             $this->_logger = new \Zend\Log\Logger();
             $this->_logger->addWriter(new \Zend\Log\Writer\Stream($this->config['logfile']));
         }
     }
     $this->console("Running server...");
     // connect and listen primary socket
     $this->__socketListener();
     // throw console log (if enable)
     $this->console(sprintf("Listening on: %s:%d", $this->config['host'], $this->config['port']));
     $this->console(sprintf("Clients: %d / %d", $this->_clientCount, $this->config['max_clients']));
 }
Exemplo n.º 25
0
 public static function doRequest($url, array $postData = null, $method = Request::METHOD_GET)
 {
     $client = self::getClientInstance();
     $client->resetParameters();
     $client->setEncType(Client::ENC_URLENCODED);
     $client->setUri($url);
     $client->setMethod($method);
     if ($postData === null) {
         $postData = array();
     }
     $postData['access_token'] = self::getSession()->accessToken;
     if ($method == Request::METHOD_POST && $postData !== null) {
         $client->setParameterPost($postData);
     }
     if (($method == Request::METHOD_GET || $method == Request::METHOD_DELETE) && $postData !== null) {
         $client->setParameterGet($postData);
     }
     $response = $client->send();
     if ($response->isSuccess()) {
         return JsonDecoder::decode($response->getBody(), Json::TYPE_ARRAY);
     } else {
         $logger = new Logger();
         $logger->addWriter(new Stream('data/logs/apiclient.log'));
         $logger->debug($response->getBody());
         return FALSE;
     }
 }
Exemplo n.º 26
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $workerManager = $serviceLocator->get(WorkerManager::class);
     $writer = new CsvStream('data/logs/daemon.' . date('Y-m-d') . '.csv');
     $writer->setFormatter(new Xml(['rootElement' => 'log']));
     $logger = new Logger();
     $logger->addWriter(new Stream(fopen('php://output', 'w')));
     $logger->addWriter($writer);
     $config = $serviceLocator->get('Config');
     $config = $config['zource_daemon'];
     $pheanstalk = new Pheanstalk($config['host'], $config['port'], $config['timeout']);
     foreach ($config['tubes'] as $tube) {
         $pheanstalk->watch($tube);
     }
     $pheanstalk->ignore('default');
     return new Daemon($pheanstalk, $workerManager, $logger, $config['lifetime'], $config['interval']);
 }
Exemplo n.º 27
0
 public function logTirage($randomize)
 {
     $path = __DIR__ . '/../../../../../data/log/log_tirage.php';
     $logger = new Logger();
     $writer = new Stream($path);
     $logger->addWriter($writer);
     $logger->log(Logger::INFO, $randomize);
 }
Exemplo n.º 28
0
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $logger = new Logger();
     $file = __DIR__ . '/../../../../../logs/' . date('Y-m-d') . '-error.log';
     $writer = new Stream($file);
     $logger->addWriter($writer);
     return $logger;
 }
Exemplo n.º 29
0
 /**
  * Log de warn
  * @param  string $pathLog caminho do erro
  * @param  string $message mensagem de erro
  * @return boolean
  */
 public static function warn($pathLog, $message)
 {
     self::createLogger();
     self::$logger->addWriter(new \Zend\Log\Writer\Stream($pathLog . DIRECTORY_SEPARATOR . "warn.log"));
     self::$logger->warn($message);
     self::destroyLogger();
     return TRUE;
 }
Exemplo n.º 30
0
 public function perform()
 {
     $queueName = isset($this->args['name']) ? $this->args['name'] : 'error';
     $writer = new Log\Writer\Stream(EVA_PUBLIC_PATH . '/logs/' . $queueName . '.log');
     $logger = new Log\Logger();
     $logger->addWriter($writer);
     $logger->info("Worker {$queueName} is working");
 }