当前位置: 首页>>代码示例>>PHP>>正文


PHP DefaultLogger类代码示例

本文整理汇总了PHP中DefaultLogger的典型用法代码示例。如果您正苦于以下问题:PHP DefaultLogger类的具体用法?PHP DefaultLogger怎么用?PHP DefaultLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DefaultLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildFinished

 /**
  * Sends the mail
  *
  * @see DefaultLogger#buildFinished
  * @param BuildEvent $event
  */
 public function buildFinished(BuildEvent $event)
 {
     parent::buildFinished($event);
     if (empty($this->_tolist)) {
         return;
     }
     $hdrs = array('From' => $this->_from, 'Subject' => $this->_subject . (empty($event) ? " (build succesful)" : " (build failed)"));
     $mail = Mail::factory('mail');
     $mail->send($this->_tolist, $hdrs, $this->_mailMessage);
 }
开发者ID:sergeytsivin,项目名称:haru,代码行数:16,代码来源:MailLogger.php

示例2: buildFinished

 /**
  * Sends the mail
  *
  * @see DefaultLogger#buildFinished
  * @param BuildEvent $event
  */
 public function buildFinished(BuildEvent $event)
 {
     parent::buildFinished($event);
     $project = $event->getProject();
     $properties = $project->getProperties();
     $filename = $properties['phing.log.mail.properties.file'];
     // overlay specified properties file (if any), which overrides project
     // settings
     $fileProperties = new Properties();
     $file = new PhingFile($filename);
     try {
         $fileProperties->load($file);
     } catch (IOException $ioe) {
         // ignore because properties file is not required
     }
     foreach ($fileProperties as $key => $value) {
         $properties['key'] = $project->replaceProperties($value);
     }
     $success = $event->getException() === null;
     $prefix = $success ? 'success' : 'failure';
     try {
         $notify = StringHelper::booleanValue($this->getValue($properties, $prefix . '.notify', 'on'));
         if (!$notify) {
             return;
         }
         if (is_string(Phing::getDefinedProperty('phing.log.mail.subject'))) {
             $defaultSubject = Phing::getDefinedProperty('phing.log.mail.subject');
         } else {
             $defaultSubject = $success ? 'Build Success' : 'Build Failure';
         }
         $hdrs = array();
         $hdrs['From'] = $this->getValue($properties, 'from', $this->from);
         $hdrs['Reply-To'] = $this->getValue($properties, 'replyto', '');
         $hdrs['Cc'] = $this->getValue($properties, $prefix . '.cc', '');
         $hdrs['Bcc'] = $this->getValue($properties, $prefix . '.bcc', '');
         $hdrs['Body'] = $this->getValue($properties, $prefix . '.body', '');
         $hdrs['Subject'] = $this->getValue($properties, $prefix . '.subject', $defaultSubject);
         $tolist = $this->getValue($properties, $prefix . '.to', $this->tolist);
     } catch (BadMethodCallException $e) {
         $project->log($e->getMessage(), Project::MSG_WARN);
     }
     if (empty($tolist)) {
         return;
     }
     $mail = Mail::factory('mail');
     $mail->send($tolist, $hdrs, $this->mailMessage);
 }
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:53,代码来源:MailLogger.php

示例3: buildFinished

 /**
  * Fired when the build finishes, this adds the time taken and any
  * error stacktrace to the build element and writes the document to disk.
  *
  * @param BuildEvent $event An event with any relevant extra information.
  *                          Will not be <code>null</code>.
  * @throws BuildException
  */
 public function buildFinished(BuildEvent $event)
 {
     $elapsedTime = Phing::currentTimeMillis() - $this->getBuildTimerStart();
     $this->getBuildElement()->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
     if ($event->getException() != null) {
         $this->getBuildElement()->setAttribute(XmlLogger::ERROR_ATTR, $event->getException()->getMessage());
         $errText = $this->getDoc()->createCDATASection($event->getException()->getTraceAsString());
         $stacktrace = $this->getDoc()->createElement(XmlLogger::STACKTRACE_TAG);
         $stacktrace->appendChild($errText);
         $this->getBuildElement()->appendChild($stacktrace);
     }
     $this->getDoc()->appendChild($this->getBuildElement());
     $outFilename = $event->getProject()->getProperty("JsonLogger.file");
     if ($outFilename == null) {
         $outFilename = "log.json";
     }
     try {
         $stream = $this->getOut();
         if ($stream === null) {
             $stream = new FileOutputStream($outFilename);
         }
         $writer = new OutputStreamWriter($stream);
         $writer->write($this->xml2js(simplexml_import_dom($this->getDoc())));
         $writer->close();
     } catch (IOException $exc) {
         try {
             $stream->close();
             // in case there is a stream open still ...
         } catch (Exception $x) {
         }
         throw new BuildException("Unable to write log file.", $exc);
     }
     // cleanup:remove the buildElement
     $this->setBuildElement(null);
     array_pop($this->getElementStack());
     array_pop($this->getTimesStack());
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:45,代码来源:JsonLogger.php

示例4: buildFinished

 /**
  *  Logs whether the build succeeded or failed, and any errors that
  *  occured during the build. Also outputs the total build-time.
  *
  * @param  BuildEvent  The BuildEvent
  *
  * @see    BuildEvent::getException()
  */
 public function buildFinished(BuildEvent $event)
 {
     $error = $event->getException();
     if ($error === null) {
         $msg = "Finished successful build.";
     } else {
         $msg = "Build failed. [reason: " . $error->getMessage() . "]";
     }
     $this->logger()->log($msg . " Total time: " . DefaultLogger::formatTime(Phing::currentTimeMillis() - $this->startTime));
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:18,代码来源:PearLogListener.php

示例5: createLogger

 /**
  * Creates the default build logger for sending build events to the log.
  * @return BuildLogger The created Logger
  */
 private function createLogger()
 {
     if ($this->loggerClassname !== null) {
         self::import($this->loggerClassname);
         // get class name part
         $classname = self::import($this->loggerClassname);
         $logger = new $classname();
         if (!$logger instanceof BuildLogger) {
             throw new BuildException($classname . ' does not implement the BuildLogger interface.');
         }
     } else {
         require_once 'phing/listener/DefaultLogger.php';
         $logger = new DefaultLogger();
     }
     $logger->setMessageOutputLevel(self::$msgOutputLevel);
     $logger->setOutputStream(self::$out);
     $logger->setErrorStream(self::$err);
     return $logger;
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:23,代码来源:phing.php

示例6: taskFinished

 /**
  * Fired when a task finishes building, this adds the time taken
  * to the appropriate task element in the log.
  *
  * @param BuildEvent $event An event with any relevant extra information.
  *                          Will not be <code>null</code>.
  */
 public function taskFinished(BuildEvent $event)
 {
     $taskTimerStart = array_pop($this->timesStack);
     $taskElement = array_pop($this->elementStack);
     $elapsedTime = Phing::currentTimeMillis() - $taskTimerStart;
     $taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
     $parentElement = $this->elementStack[count($this->elementStack) - 1];
     $parentElement->appendChild($taskElement);
 }
开发者ID:codebubb,项目名称:web_ssh,代码行数:16,代码来源:XmlLogger.php

示例7: createLogger

 /**
  * Creates the default build logger for sending build events to the log.
  * @return BuildListener The created Logger
  */
 private function createLogger()
 {
     if ($this->loggerClassname !== null) {
         self::import($this->loggerClassname);
         // get class name part
         $classname = self::import($this->loggerClassname);
         $logger = new $classname();
     } else {
         require_once 'phing/listener/DefaultLogger.php';
         $logger = new DefaultLogger();
     }
     $logger->setMessageOutputLevel(self::$msgOutputLevel);
     return $logger;
 }
开发者ID:domenypl,项目名称:symfony1-legacy,代码行数:18,代码来源:Phing.php

示例8: taskFinished

 /**
  * Fired when a task finishes building, this adds the time taken
  * to the appropriate task element in the log.
  *
  * @param BuildEvent An event with any relevant extra information.
  *              Will not be <code>null</code>.
  */
 function taskFinished(BuildEvent $event)
 {
     $task = $event->getTask();
     $elapsedTime = Phing::currentTimeMillis() - $this->taskTimerStart;
     $this->taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::_formatTime($elapsedTime));
     $this->targetElement->appendChild($this->taskElement);
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:14,代码来源:XmlLogger.php

示例9: setErrorStream

 /**
  * Sets the error stream for the logging.
  *
  * @param      OutputStream The error stream.
  *
  * @see        DefaultLogger::setOutputStream()
  *
  * @author     Noah Fontes <noah.fontes@bitextender.com>
  * @since      1.0.0
  */
 public function setErrorStream(OutputStream $error)
 {
     parent::setErrorStream($error);
     $this->logger->setErrorStream($error);
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:15,代码来源:AgaviBuildLogger.php

示例10: testError

 public function testError()
 {
     $logger = new DefaultLogger();
     $this->expectOutputString("[" . date('Y-m-d H:i:s') . "][ERROR] test msg\n");
     $logger->error('test msg');
 }
开发者ID:fustundag,项目名称:awscw-custom-metrics,代码行数:6,代码来源:DefaultLoggerTest.php

示例11: __construct

 /**
  * Construct new HtmlColorLogger
  * Perform initializations that cannot be done in var declarations.
  */
 public function __construct()
 {
     parent::__construct();
     $this->errColor = self::PREFIX . self::CLASS_ERR . self::SUFFIX;
     $this->warnColor = self::PREFIX . self::CLASS_WARN . self::SUFFIX;
     $this->infoColor = self::PREFIX . self::CLASS_INFO . self::SUFFIX;
     $this->verboseColor = self::PREFIX . self::CLASS_VERBOSE . self::SUFFIX;
     $this->debugColor = self::PREFIX . self::CLASS_DEBUG . self::SUFFIX;
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:13,代码来源:HtmlColorLogger.php

示例12: messageLogged

 function messageLogged(BuildEvent $event)
 {
     if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() || trim($event->getMessage() === "")) {
         return;
     }
     if ($this->targetName !== null) {
         print $this->lSep . "Target: " . $this->targetName . $this->lSep;
         $this->targetName = null;
     }
     parent::messageLogged($event);
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:11,代码来源:NoBannerLogger.php

示例13: messageLogged

 function messageLogged(BuildEvent $event)
 {
     if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() || trim($event->getMessage() === "")) {
         return;
     }
     if ($this->targetName !== null) {
         $msg = PHP_EOL . $event->getProject()->getName() . ' > ' . $this->targetName . ':' . PHP_EOL;
         $this->printMessage($msg, $this->out, $event->getPriority());
         $this->targetName = null;
     }
     parent::messageLogged($event);
 }
开发者ID:sergeytsivin,项目名称:haru,代码行数:12,代码来源:NoBannerLogger.php

示例14: __construct

 /**
  * Construct new AnsiColorLogger
  * Perform initializations that cannot be done in var declarations.
  */
 public function __construct()
 {
     parent::__construct();
     $this->errColor = self::PREFIX . self::ATTR_DIM . self::SEPARATOR . self::FG_RED . self::SUFFIX;
     $this->warnColor = self::PREFIX . self::ATTR_DIM . self::SEPARATOR . self::FG_MAGENTA . self::SUFFIX;
     $this->infoColor = self::PREFIX . self::ATTR_DIM . self::SEPARATOR . self::FG_CYAN . self::SUFFIX;
     $this->verboseColor = self::PREFIX . self::ATTR_DIM . self::SEPARATOR . self::FG_GREEN . self::SUFFIX;
     $this->debugColor = self::PREFIX . self::ATTR_DIM . self::SEPARATOR . self::FG_BLUE . self::SUFFIX;
 }
开发者ID:andrew-ejov,项目名称:start-template,代码行数:13,代码来源:AnsiColorLogger.php

示例15: buildFinished

 public function buildFinished(BuildEvent $event)
 {
     if ($event->getException() != null) {
         parent::buildFinished($event);
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:6,代码来源:SilentLogger.php


注:本文中的DefaultLogger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。