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


PHP Log::getLogger方法代码示例

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


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

示例1: match

 public function match($url)
 {
     $ok = preg_match($this->reg, $url, $match);
     Log::getLogger()->info('Rewrite.Rule.match reg: %s url: %s, matchCount: %s', $this->reg, $url, $ok);
     if (!$ok) {
         $match = null;
     }
     return $match;
 }
开发者ID:kxbrand,项目名称:php-simulation-env,代码行数:9,代码来源:Rule.class.php

示例2: init

 public static function init($root, $encoding = 'utf-8', array $opt = array())
 {
     Mock::$logger = Log::getLogger();
     $root = Util::normalizePath($root);
     Mock::$wwwRoot = $root;
     Mock::$testPath = $root . '/test';
     //set encoding
     Mock::setEncoding($encoding);
 }
开发者ID:kxbrand,项目名称:php-simulation-env,代码行数:9,代码来源:Mock.class.php

示例3: logout

 function logout()
 {
     if (isset($_SESSION["username"])) {
         Log::getLogger()->write(Log::LOG_VERBOSE, "User " . $_SESSION["username"] . " is logged off");
     }
     unset($_SESSION["connected"]);
     unset($_SESSION["username"]);
     unset($_SESSION["user_id"]);
     session_destroy();
     // Redirect automatically to the Profile page.
     $_SESSION["message"] = array("type" => "success", "title" => "Déconnexion terminée", "descr" => "Vous êtes maintenant déconnecté");
     header('Location: ' . '/monitoring/?v=dashboard');
 }
开发者ID:yashodhank,项目名称:Monitoring,代码行数:13,代码来源:auth.php

示例4: exceptionHandler

 /**
  * Handler for uncatched exceptions.
  *
  * @param Exception $exception
  */
 public static function exceptionHandler($exception)
 {
     error_log("Unhandled exception: Code {$exception->getCode()}; Message: {$exception->getMessage()}");
     if (class_exists('Log') && !is_null(Log::getLogger())) {
         Log::err(sprintf('Lpf_ExceptionHandler: Unhandled exception [%s] `%s`', $exception->getCode(), $exception->getMessage()));
     }
     if (Config::DEBUG_MODE) {
         echo "[Debug mode] Unhandled exception: Code {$exception->getCode()}; Message: {$exception->getMessage()}\r\n";
         echo $exception->getTraceAsString();
         exit;
     } else {
         if ($exception->getCode() == 404) {
             header("HTTP/1.0 404 Not Found", true, 404);
             die('<h1 style="text-align:center;">Error 404: Page Not Found</h1>');
         } else {
             header("HTTP/1.0 500 Internal Server Error", true, 500);
             die('<h1 style="text-align:center;">Error 500: Internal Server Error</h1>');
         }
     }
 }
开发者ID:lknight,项目名称:habrometr,代码行数:25,代码来源:ErrorHandler.php

示例5: testGetLogger

 /**
  * @covers Log::getLogger
  * @author mr2longly
  */
 public function testGetLogger()
 {
     $logger = Log::getLogger('myLogger');
     $this->assertTrue($logger instanceof Log);
 }
开发者ID:hebaoxia,项目名称:simplify-log,代码行数:9,代码来源:LogTest.php

示例6: define

<?php

define('WWW_ROOT', __DIR__);
require __DIR__ . '/../log/Log.class.php';
require __DIR__ . '/Rewrite.class.php';
Log::getLogger(array('level' => Log::ALL));
class Render implements RewriteHandle
{
    public function process($file)
    {
        echo file_get_contents($file);
    }
}
$rewrite = new Rewrite(__DIR__ . '/test');
$rewrite->addConfigFile('home.conf');
$rewrite->addConfigFile('common.conf');
$rewrite->addRewriteHandle('tpl', new Render());
$rewrite->dispatch('/home/test');
开发者ID:kxbrand,项目名称:php-simulation-env,代码行数:18,代码来源:TestRewrite.php

示例7: assignCategoryLogs

 function assignCategoryLogs($tpl)
 {
     $logs = Log::getLogger()->tail(100);
     $logs = preg_replace("/[\r\n]/", "<br/>", $logs);
     $logs = str_replace('\\t', "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $logs);
     $tpl->assign('logs', $logs);
     $tpl->assign('view', 'view_dashboard_logs');
 }
开发者ID:yashodhank,项目名称:Monitoring,代码行数:8,代码来源:dashboard.php

示例8: __syncSuperAdminIfNeeded

 private function __syncSuperAdminIfNeeded()
 {
     if (!isset($_SESSION["user_id"]) || $_SESSION["user_id"] != -1) {
         return;
     }
     try {
         $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_AUTH_DBNAME . "";
         $pdo = new PDO($dsn, DB_AUTH_USERNAME, DB_AUTH_PASSWORD);
         $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
         $sth = $pdo->prepare("UPDATE users SET username = ?, password = ?, email = ?, email_active = ?, phone = ?, phone_active = ? WHERE id = -1");
         $res = $sth->execute(array(AC_SUPERADMIN_USERNAME, AC_SUPERADMIN_PASSWORD, AC_SUPERADMIN_EMAIL, AC_SUPERADMIN_EMAIL_ACTIVE, AC_SUPERADMIN_PHONE, AC_SUPERADMIN_PHONE_ACTIVE));
         if ($res == 0) {
             throw new Exception("Unable to sync the SuperAdmin user with the database.");
         }
     } catch (Exception $e) {
         Log::getLogger()->write(Log::LOG_ERROR, "Unable to sync the SuperAdmin user with the database.", $e);
     }
 }
开发者ID:yashodhank,项目名称:Monitoring,代码行数:19,代码来源:security.php

示例9: __error_handler

function __error_handler($error, $error_string, $filename, $line, $symbols)
{
    $string = "{$error_string} occured in file {$filename} line {$line}";
    Log::getLogger()->write(Log::LOG_DEBUG, $string, $error);
}
开发者ID:yashodhank,项目名称:Monitoring,代码行数:5,代码来源:setup.php

示例10: useErrorLog

 /**
  * Register an error_log handler.
  *
  * @param string $level
  * @param integer $messageType
  * @return void
  * @static
  */
 public static function useErrorLog($level = 'debug', $messageType = 0)
 {
     \Log::getLogger()->useErrorLog($level, $messageType);
 }
开发者ID:ohworkit,项目名称:Sirius,代码行数:12,代码来源:_ide_helper.php

示例11: testSanitizing

 public function testSanitizing()
 {
     Log::addLogger('some - LOGGER', 'aBcD');
     return $this->assertIdentical('some - LOGGER', Log::getLogger('AbCd'));
 }
开发者ID:enyo,项目名称:rincewind,代码行数:5,代码来源:Log.stest.php

示例12: displayPage

 /** Display the requested page. */
 function displayPage($webPage)
 {
     setcookie("last-page", full_url($_SERVER));
     if (isset($_SESSION["message"])) {
         $message = $_SESSION["message"];
         $this->tpl->assign('message', $message);
         unset($_SESSION["message"]);
     }
     try {
         if (isset($this->pdo)) {
             $sth = $this->pdo->prepare("SELECT COUNT(alerts.id) AS c FROM alerts WHERE resolved = 0");
             $sth->execute();
             $countAlerts = $sth->fetch(PDO::FETCH_ASSOC);
             $countAlerts = $countAlerts["c"];
             $this->tpl->assign('countAlerts', $countAlerts);
         }
     } catch (Exception $e) {
         Log::getLogger()->write(Log::LOG_ERROR, "Unable to request DB", $e);
         $this->tpl->assign('countAlerts', 0);
     }
     try {
         switch ($webPage) {
             case CONTROLLER_DASHBOARD:
                 $c = new DashboardController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_ADMIN:
                 $c = new AdminController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_PROFILE:
                 $c = new ProfileController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_HELP:
                 $c = new HelpController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_LOGIN:
                 $c = new LoginController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_DEFAULT:
             default:
                 $this->tpl->display('controller_blank.tpl');
                 break;
         }
     } catch (SecurityAccessException $sae) {
         if ($this->tpl->getTemplateVars('message') == null) {
             $_SESSION["message"] = array("type" => "danger", "title" => "Accès interdit", "descr" => "Cette page est protégée. Veuillez vous connecter avec un compte ayant accès à cette page.");
             $this->tpl->assign('message', $_SESSION["message"]);
             unset($_SESSION["message"]);
         }
         // A Security Access Exception occurs when the user cannot see the asked page.
         // So in this case let's redirect to login page.
         $c = new LoginController($this->pdo);
         $c->buildTemplate($this->tpl);
     } catch (SecurityException $se) {
         // A Security Exception is more generic so display a message.
         Log::getLogger()->write(Log::LOG_ALERT, "Security Exception dropped on dispatcher", $se);
         $_SESSION["message"] = array("type" => "danger", "title" => "Erreur", "descr" => $se->getMessage());
         $this->tpl->assign('message', $_SESSION["message"]);
         unset($_SESSION["message"]);
         $this->tpl->display('controller_error.tpl');
     } catch (Exception $e) {
         Log::getLogger()->write(Log::LOG_ERROR, "Unknown Exception dropped on dispatcher", $e);
         // A very generic exception.
         $_SESSION["message"] = array("type" => "danger", "title" => "Erreur", "descr" => $e->getMessage());
         $this->tpl->assign('message', $_SESSION["message"]);
         unset($_SESSION["message"]);
         $this->tpl->display('controller_error.tpl');
     }
 }
开发者ID:yashodhank,项目名称:Monitoring,代码行数:74,代码来源:dispatcher.php

示例13: dispatch

 public function dispatch($strUrl = null)
 {
     $url = $strUrl;
     if (isset($_SERVER['REQUEST_URI'])) {
         $url = $_SERVER['REQUEST_URI'];
     }
     if (!$url) {
         return;
     }
     foreach ($this->_rules as $rule) {
         if ($rule->match($url)) {
             $target = $rule->fill($url);
             if ($rule->type !== Rule::REDIRECT) {
                 $target = preg_replace('@\\?.*$@', '', $target);
             }
             Log::getLogger()->info('Rewirte.dispatch target %s', $target);
             if ($rule->type === Rule::REWRITE) {
                 $this->rewriteProcess(WWW_ROOT . '/' . $target);
             } else {
                 if ($rule->type === Rule::REDIRECT) {
                     header('Location: ' . $target);
                 } else {
                     if ($rule->type === Rule::RENDER) {
                         //@TODO ugly, it's old code
                         if (isset($this->_factoryHandles['tpl'])) {
                             $handle = $this->_factoryHandles['tpl'];
                             $handle->process($target);
                         } else {
                             Log::getLogger()->warn('Rewirte.dispatch Not found process handle of the tpl template file.');
                         }
                     }
                 }
             }
             exit;
         }
     }
 }
开发者ID:kxbrand,项目名称:php-simulation-env,代码行数:37,代码来源:Rewrite.class.php


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