本文整理汇总了PHP中Logging::logMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Logging::logMessage方法的具体用法?PHP Logging::logMessage怎么用?PHP Logging::logMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logging
的用法示例。
在下文中一共展示了Logging::logMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
//validation from
$v = new Lib_FormValidation($this->validation);
$res = $v->validate('form1');
if (FALSE === $res) {
$e = $v->errors();
var_dump($e);
Logging::logMessage('error, validation forom error, detail see other.', Logging::LEVEL_ERROR);
exit('用户名不能为空,密码不能是全数字或全字母');
}
$params = $v->params();
$name = $params['name'];
$passwd = $params['passwd'];
$where['name'] = $name;
$where['password'] = $passwd;
Logging::logMessage('The sing name:' . $name . ', password :' . $passwd);
$res = F::$f->Model_User->selectOne($where);
var_dump($res);
}
示例2: _getDbInstance
protected function _getDbInstance($is_read = TRUE)
{
$db_choose_name = $this->_db_master_name;
//main
if (Model_Db::$_forceReadOnMaster || $this->_readOnMaster) {
$is_read = FAlSE;
}
if ($is_read) {
$db_choose_name = $this->_db_read_name;
//query
}
if (isset($this->_db_instance[$db_choose_name]) && is_object($this->_db_instance[$db_choose_name])) {
return $this->_db_instance[$db_choose_name];
}
//获得一个db
if (empty($this->_db_zone_name)) {
return NULL;
}
$db_config = Config::get('DB_CONFIG');
if (!isset($db_config[$this->_db_zone_name][$db_choose_name])) {
return NULL;
}
$db_config = $db_config[$this->_db_zone_name][$db_choose_name];
if ($db_choose_name == $this->_db_read_name) {
$query_count = count($db_config);
if ($query_count > 1) {
$i = mt_rand(0, count($db_config) - 1);
$db_config = $db_config[$i];
} else {
$db_config = $db_config[0];
}
}
$dsn = "mysql:host={$db_config['host']};dbname={$db_config['database']};";
if (isset($db_config['charset'])) {
$dsn .= "charset={$db_config['charset']}";
}
$options = array();
if (version_compare(PHP_VERSION, '5.3.6', '<')) {
$options[PDO::MYSQL_ATTR_INIT_COMMAND] = "set names {$db_config['charset']}";
}
$db = FALSE;
try {
$db = new PDO($dsn, $db_config['user'], $db_config['password'], $options);
} catch (Exception $e) {
$db = FALSE;
}
if (!empty($db)) {
$this->_db_instance[$db_choose_name] = $db;
return $db;
} else {
Logging::logMessage('DB_ERROR new PDO error! dsn:' . $dsn, Logging::LEVEL_FATAL);
return FALSE;
}
}
示例3: log_message
/**
* 记录log,默认级别是info, 可以配置文件配置,sys_id默认'-',可全局配置
*/
function log_message($log_msg, $level = NULL, $sys_id = NULL)
{
return Logging::logMessage($log_msg, $level, $sys_id);
}
示例4: _getDbInstance
protected function _getDbInstance($is_read = TRUE)
{
$db_choose_name = $this->_db_master_name;
/*
if (Model_Db::$_forceReadOnMaster || $this->_readOnMaster) {
$is_read = FAlSE;
}
*/
if ($is_read) {
$db_choose_name = $this->_db_read_name;
}
if (isset($this->_db_instance[$db_choose_name]) && is_object($this->_db_instance[$db_choose_name])) {
return $this->_db_instance[$db_choose_name];
}
//获得一个db
if (empty($this->_db_zone_name)) {
return NULL;
}
$db_config = Config::get('DB_CONFIG');
if (!isset($db_config[$this->_db_zone_name][$db_choose_name])) {
return NULL;
}
$db_config = $db_config[$this->_db_zone_name][$db_choose_name];
if ($db_choose_name == $this->_db_read_name) {
$query_count = count($db_config);
if ($query_count > 1) {
$i = mt_rand(0, count($db_config) - 1);
$db_config = $db_config[$i];
} else {
$db_config = $db_config[0];
}
}
$dsn = "pgsql:host={$db_config['host']};dbname={$db_config['database']};port={$db_config['port']};";
$options = array();
$db = FALSE;
try {
$db = new PDO($dsn, $db_config['user'], $db_config['password'], $options);
} catch (Exception $e) {
$db = FALSE;
}
if (!empty($db)) {
$this->_db_instance[$db_choose_name] = $db;
return $db;
} else {
Logging::logMessage('DB_ERROR new PDO error! dsn:' . $dsn, Logging::LEVEL_FATAL);
return FALSE;
}
}