本文整理匯總了PHP中logger::log_error方法的典型用法代碼示例。如果您正苦於以下問題:PHP logger::log_error方法的具體用法?PHP logger::log_error怎麽用?PHP logger::log_error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類logger
的用法示例。
在下文中一共展示了logger::log_error方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_slave_redis
public static function get_slave_redis($source_name)
{
if (!isset(self::$redis_nodes['slave'][$source_name])) {
$dsns = config::get_logic('redis.' . $source_name . '.slaves', []);
if ($dsns === []) {
$dsns = array(config::get_logic('redis.' . $source_name . '.master'));
}
$all_attempts_failed = true;
foreach ($dsns as $dsn) {
$url_parts = parse_url($dsn);
extract($url_parts, EXTR_SKIP);
$redis_node = new redis_slave_node();
if ($redis_node->connect($host, $port, 2)) {
self::$redis_nodes['slave'][$source_name] = $redis_node;
$all_attempts_failed = false;
break;
} else {
logger::log_error("cannot connect to dsn: '{$dsn}', maybe failed?");
}
}
if ($all_attempts_failed) {
throw new server_except("cannot connect to all dsns of redis source: {$source_name}");
}
}
return self::$redis_nodes['slave'][$source_name];
}
示例2: exception_handler
public static function exception_handler(\Exception $e)
{
if (config::get_kern('log_errors', true)) {
$msg = $e->getMessage() . ' in file: ' . $e->getFile() . ' in line: ' . $e->getLine();
if (config::get_kern('log_with_trace', true)) {
$msg .= ' with trace: ' . var_export($e->getTrace(), true);
}
logger::log_error($msg);
}
self::show_exception($e);
}
示例3: get_slave_rdb_node_from_source_name
protected static function get_slave_rdb_node_from_source_name($source_name)
{
static $slave_rdb_nodes_by_source_name = [];
if (!array_key_exists($source_name, $slave_rdb_nodes_by_source_name)) {
$dsns = config::get_logic('rdb.sources.' . $source_name . '.slaves', []);
if ($dsns === []) {
$dsns = array(config::get_logic('rdb.sources.' . $source_name . '.master'));
}
shuffle($dsns);
$all_attempts_failed = true;
foreach ($dsns as $dsn) {
try {
$slave_rdb_nodes_by_source_name[$source_name] = rdb_node_pool::get_rdb_node('slave', $dsn);
$all_attempts_failed = false;
break;
} catch (server_except $except) {
logger::log_error("cannot connect to dsn: '{$dsn}', maybe failed?");
}
}
if ($all_attempts_failed) {
throw new server_except("cannot connect to all slave dsns of source '{$source_name}'");
}
}
return $slave_rdb_nodes_by_source_name[$source_name];
}