public function alert($message, array $args = [], array $context = []) { if (count($args)) { $message = vsprintf($message, $args); } return parent::alert($message, $context); }
public function sendAttentionMail($inspectionMessage) { $this->getMailer()->setBody($inspectionMessage . " | " . serialize($this->executedWithError)); $sentResult = $this->getMailer()->send(); $this->logger->alert("Mail from " . $this->getMailer()->getFrom() . " TO: " . serialize($this->getMailer()->getAllRecipientAddresses()) . " with subject " . $this->getMailer()->getSubject() . " contain " . serialize($this->getMailer()->getBody()) . " with result " . serialize($sentResult) . " was sent."); return null; }
public function refund(PayableInterface $payable, $reference) { try { $amount = $this->getAmountBySmallestCurrencyUnit($payable); return $this->_charge->refund($reference, $amount); } catch (\Exception $e) { $this->_logger->alert($e); throw $e; } }
/** * */ public function testPushErrors() { $redis = \Mockery::mock('Predis\\Client')->shouldReceive('publish')->times(8)->with('log', \Mockery::any())->mock(); $monolog = new Logger('test'); $monolog->pushHandler(new PublishHandler(new RedisPublisher($redis))); $monolog->debug('the message was: {message}', ['DEBUG!']); $monolog->info('the message was: {message}', ['INFO!']); $monolog->notice('the message was: {message}', ['NOTICE!']); $monolog->warning('the message was: {message}', ['WARNING!']); $monolog->error('the message was: {message}', ['ERROR!']); $monolog->critical('the message was: {message}', ['CRITICAL!']); $monolog->alert('the message was: {message}', ['ALERT!']); $monolog->emergency('the message was: {message}', ['EMERGENCY!']); }
/** * Adds a log record at the ALERT level. * * @param string $message The log message * @param array $context The log context * @return Boolean Whether the record has been processed * @static */ public static function alert($message, $context = array()) { return \Monolog\Logger::alert($message, $context); }
public function testError(FailEvent $e) { $this->logger->alert($e->getFail()->getMessage()); $this->logger->info("# ERROR #"); }
/** * Adds a log record at the ALERT level. * * @param string $message The log message * @param array $context The log context * @return Boolean Whether the record has been processed */ public function alert($message, array $context = array()) { return $this->_logger->alert($message, $context); }
public function testError(\Codeception\Event\Fail $e) { $this->logger->alert($e->getFail()->getMessage()); $this->logger->info("# ERROR #"); }
/** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param string $message * @param array $params * @param array $context * @return null */ public function alert($message, array $params = array(), array $context = array()) { $logMessage = $this->createMessage($message, $params); $this->logger->alert($logMessage, $context); }
/** * @inheritdoc * @return boolean Whether the record has been processed. */ public function alert($message, array $context = []) { return $this->_monolog->alert($message, $context); }
public function logFinishShutDown() { $this->logger->alert("Finish shutDown in " . $this->shutDownType . "| PID: " . posix_getpid()); return null; }
try { $ttl = $arguments['ttl'] && is_numeric($arguments['ttl']) ? (int) $arguments['ttl'] : 0; $deletedJobs = $queue->cleanupTable($ttl); cli\line("%g{$deletedJobs} jobs tidied up from '{$config['table_name']}'%n"); } catch (Exception $e) { cli\err("%rUnable to cleanup table: " . $e->getMessage() . "%n"); exit(1); } exit(0); } //------------------------------------ // Validate the table (and connection) try { $valid = $queue->isTableValid(); if (is_array($valid)) { $logger->alert("Errors were found when validating the table is setup correctly", $valid); exit(1); } } catch (Exception $e) { $logger->alert("Unable to connect to DynamoDB (and validate the table)", ['exception' => $e]); exit(1); } //------------------------------------ // Create the process handler #TODO - This will become a config option so custom Handlers can be used. $handler = new \DynamoQueue\Worker\Handler\Autoloader(); //------------------------------------ // Create the (a) Worker $worker = new \DynamoQueue\Worker\Worker($queue, $handler, $logger); //--- declare (ticks=1);
/** * @covers Monolog\Logger::addRecord */ public function testProcessorsNotCalledWhenNotHandled() { $logger = new Logger(__METHOD__); $handler = $this->getMock('Monolog\\Handler\\HandlerInterface'); $handler->expects($this->once())->method('isHandling')->will($this->returnValue(false)); $logger->pushHandler($handler); $that = $this; $logger->pushProcessor(function ($record) use($that) { $that->fail('The processor should not be called'); }); $logger->alert('test'); }
/** * @param string $message * @param array $context * @return bool */ public function alert($message, array $context = array()) { return parent::alert($message, $context); }
public function alert($msg) { $this->logger->alert($msg); }
<?php include 'basics.php'; use unreal4u\MonologHandler; use unreal4u\TgLog; use Monolog\Logger; #$monologTgLogger = new MonologHandler(new TelegramLog(BOT_TOKEN), A_USER_CHAT_ID, Logger::DEBUG); // Sends from DEBUG+ $monologTgLogger = new MonologHandler(new TgLog(BOT_TOKEN), A_USER_CHAT_ID, Logger::ERROR); // Sends ERROR+ //Create logger $logger = new Logger('TelegramLogger'); $logger->pushHandler($monologTgLogger); //Now you can use the logger, and further attach additional information $logger->debug('Nobody gives a dime for debug messages', ['moreInfo' => 'Within here']); $logger->info('A user has logged in'); $logger->notice('Something unusual has happened!', ['it did indeed']); $logger->warning('Somebody should attend this', ['some', 'extra' => 'information']); $logger->error('Something really bad happened'); $logger->critical('A critical message', ['please' => 'Check this out']); $logger->alert('This is an alert', ['oh no...' => 'This might be urgent']); $logger->emergency('Run for your lives!', ['this is it' => 'everything has stopped working']);
/** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param string $message * @param array $context * * @return void */ public function alert($message, array $context = array()) { $this->monolog->alert($message, $context); }