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


PHP Log::instance方法代码示例

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


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

示例1: self

 public static function &get_instance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:hubs,项目名称:yuncms,代码行数:7,代码来源:Log.php

示例2: getInstance

 public static function getInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:7,代码来源:log.class.php

示例3: logger

 function logger($level, $msg, $method = null)
 {
     static $labels = array(100 => 'DEBUG', 200 => 'INFO', 250 => 'NOTICE', 300 => 'WARNING', 400 => 'ERROR', 500 => 'CRITICAL', 550 => 'ALERT', 600 => 'EMERGENCY', 700 => 'ALL');
     // make sure $level has the correct value
     if (is_int($level) and !isset($labels[$level]) or is_string($level) and !array_search(strtoupper($level), $labels)) {
         throw new \FuelException('Invalid level "' . $level . '" passed to logger()');
     }
     if (is_string($level)) {
         $level = array_search(strtoupper($level), $labels);
     }
     // get the levels defined to be logged
     $loglabels = \Config::get('log_threshold');
     // bail out if we don't need logging at all
     if ($loglabels == \Fuel::L_NONE) {
         return false;
     }
     // if profiling is active log the message to the profile
     if (\Config::get('profiling')) {
         \Console::log($method . ' - ' . $msg);
     }
     // if it's not an array, assume it's an "up to" level
     if (!is_array($loglabels)) {
         $a = array();
         foreach ($labels as $l => $label) {
             $l >= $loglabels and $a[] = $l;
         }
         $loglabels = $a;
     }
     // do we need to log the message with this level?
     if (!in_array($level, $loglabels)) {
         return false;
     }
     return \Log::instance()->log($level, (empty($method) ? '' : $method . ' - ') . $msg);
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:34,代码来源:base.php

示例4: getInstance

 public static function getInstance()
 {
     if (null == self::$instance) {
         self::$instance = new Log();
     }
     return self::$instance;
 }
开发者ID:vberzsin,项目名称:2014,代码行数:7,代码来源:Log.php

示例5: action_index

 public function action_index()
 {
     $request = $this->request->current();
     if ($request->post('submit')) {
         $login = $request->post('login');
         $password = $request->post('password');
         $ip = Request::$client_ip;
         $user_agent = Request::$user_agent;
         $remember = (bool) $this->request->post('remember');
         $fail_login_checker = new Auth_Admin_Checker($login, $ip);
         if ($fail_login_checker->check()) {
             $admin = ORM::factory('admin')->where('username', '=', $login)->and_where('delete_bit', '=', 0)->and_where('active', '=', 1)->find();
             try {
                 if ($this->acl->auth()->login($admin, $password, $remember)) {
                     $url = Session::instance()->get('BACK_URL');
                     $request->redirect(empty($url) ? Route::url('admin') : $url);
                 } else {
                     // Store fail login attempt
                     $fail_login_checker->add($password, $user_agent);
                     $this->template->set('error', __('Authentication error'));
                 }
             } catch (ORM_Validation_Exception $e) {
                 Log::instance()->add(Log::ERROR, $e->errors('') . '[' . __FILE__ . '::' . __LINE__ . ']');
             }
         } else {
             $this->template->set('error', __('To many failed login attempts. Please, wait :minutes minutes and try again.', array(':minutes' => ceil($fail_login_checker->fail_interval() / 60))));
         }
     }
     $this->template->set('logo', $this->config['logo']);
 }
开发者ID:greor,项目名称:satin-spb,代码行数:30,代码来源:auth.php

示例6: load_parts

 /**
  * Load adittionnal content part
  *
  * @param	string	$parts			part name or list of part names
  * @param	string	$sub_directory	subdirectory name
  *
  * @return	array
  **/
 public function load_parts($parts, $subcategory = NULL)
 {
     $parts = func_get_arg(0);
     $sub_directory = func_get_arg(1);
     $sub_directory = $sub_directory ? $sub_directory . '/' : NULL;
     $result = array();
     if (strpos($parts, ',') === FALSE) {
         // Just one entry
         try {
             $result[] = new Model_Page($sub_directory . $parts);
         } catch (Kohana_exception $e) {
             Log::instance()->add(Log::WARNING, $e->getMessage());
         }
     } else {
         // Multiples entries
         foreach (explode(',', $parts) as $part) {
             try {
                 $result[] = new Model_Page($sub_directory . $part);
             } catch (Kohana_exception $e) {
                 Log::instance()->add(Log::WARNING, $e->getMessage());
             }
         }
     }
     return $result;
 }
开发者ID:ziopod,项目名称:tanuki-core,代码行数:33,代码来源:Page.php

示例7: __construct

 public function __construct()
 {
     $this->input = new Input();
     $this->config = Config::instance();
     $this->log = Log::instance();
     $this->log->write('debug', 'Library Class Initialized');
 }
开发者ID:ravikathaitarm01,项目名称:fluenz1,代码行数:7,代码来源:Library.php

示例8: newInstance

 public static function newInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:nsswaga,项目名称:OSClass,代码行数:7,代码来源:Log.php

示例9: get_instance

 public static function get_instance($log_level = '', $filename = '')
 {
     if (empty(self::$instance)) {
         self::$instance = new Log($log_level, $filename);
     }
     return self::$instance;
 }
开发者ID:utumdol,项目名称:codeseed,代码行数:7,代码来源:log.class.php

示例10: background

 /**
  * Runs the function in backgroung
  * Called from our application, kohana is always loaded
  *
  * @param string $call_back function name to be called in background
  * @param array $params parameters that the call_back can recieve in order!
  * @param integer $priority for the system to do such task
  * @return integer PID
  */
 public static function background($call_back, $params = NULL, $priority = NULL)
 {
     if (self::is_callable($call_back)) {
         //if (Kohana::$environment == Kohana::DEVELOPMENT)
         //return self::execute($call_back, base64_encode(serialize($params)) );
         $script = 'cli';
         //preparing the command to execute
         if (is_array($params)) {
             $command = 'php -f ' . APPPATH . $script . EXT . ' ' . $_SERVER['KOHANA_ENV'] . ' ' . $call_back . ' ' . base64_encode(serialize($params)) . '';
         } else {
             //no params the -1 is because ::execute requires a value before the jobid if not in the cli won't work
             $command = 'php -f ' . APPPATH . $script . EXT . ' ' . $_SERVER['KOHANA_ENV'] . ' ' . $call_back . ' -1';
         }
         //priority check
         if ($priority !== NULL) {
             $command = 'nohup nice -n ' . $priority . ' ' . $command;
         } else {
             $command = 'nohup ' . $command;
         }
         //adding output
         //$command = 'su - www-data -c "'.$command.' >/dev/null 2>/dev/null"';
         $command .= ' > /dev/null & echo $!';
         //execute
         //Log::instance()->add(LOG_DEBUG,'Exec->background - command: '.$command);
         //d($command);
         $pid = shell_exec($command);
         //$pid = shell_exec($command.' >/dev/null &');  //another way without priority
         //returning
         //Log::instance()->add(LOG_DEBUG,'Exec->background - Return value PID:'.$pid);
         return (int) $pid;
     } else {
         Log::instance()->add(LOG_ERR, 'Exec->background - call_back not found - ' . print_r($call_back, 1));
         return FALSE;
     }
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:44,代码来源:exec.php

示例11: getInstance

 /**
  * @return Log
  */
 static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:10,代码来源:Log.class.php

示例12: inst

 public function inst()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:yesenfei,项目名称:extjs-file-manager,代码行数:7,代码来源:log.php

示例13: _converting

 private function _converting()
 {
     if (!empty($this->conv_func)) {
         foreach ($this->conv_func as $f) {
             $call_p = [];
             if (is_string($f)) {
                 $call_f = [$this, $f];
             } elseif (is_array($f) and is_string($f[0]) and is_array($f[1])) {
                 $call_f = [$this, $f[0]];
                 $call_p = $f[1];
             } else {
                 Log::instance()->error("Incorrect format function parameters.");
                 return FALSE;
             }
             if (!is_callable($call_f, TRUE)) {
                 Log::instance()->error("Function: {$f} may not be called.");
                 return FALSE;
             }
             $ret = call_user_func_array($call_f, $call_p);
             if ($ret === FALSE) {
                 Log::instance()->error("Function: {$call_f[1]} returned FALSE.");
                 return FALSE;
             } elseif ($this->break_conv === TRUE) {
                 break;
             }
         }
     }
     return TRUE;
 }
开发者ID:yaxus,项目名称:bg_phone_parser,代码行数:29,代码来源:Converter.php

示例14: getInstance

 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         $startTime = defined('PROCESS_START_TIME') ? PROCESS_START_TIME : microtime(true) * 1000;
         self::$instance = new self($GLOBALS['LOG'], $startTime);
     }
     return self::$instance;
 }
开发者ID:ToogleLiu,项目名称:too,代码行数:8,代码来源:Log.class.php

示例15: singleton

 public static function singleton($_idUser = null)
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c($_idUser);
     }
     return self::$instance;
 }
开发者ID:jpizzolatto,项目名称:VirtualLibrary,代码行数:8,代码来源:LogClass.php


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