本文整理汇总了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];
}