本文整理汇总了C++中LogSink::err方法的典型用法代码示例。如果您正苦于以下问题:C++ LogSink::err方法的具体用法?C++ LogSink::err怎么用?C++ LogSink::err使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogSink
的用法示例。
在下文中一共展示了LogSink::err方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
int DNS::connect( const std::string& host, const LogSink& logInstance )
{
struct addrinfo* results = 0;
resolve( &results, host, logInstance );
if( !results )
{
logInstance.err( LogAreaClassDns, "host not found: " + host );
return -ConnDnsError;
}
struct addrinfo* runp = results;
while( runp )
{
int fd = DNS::connect( runp, logInstance );
if( fd >= 0 )
return fd;
runp = runp->ai_next;
}
freeaddrinfo( results );
return -ConnConnectionRefused;
}
示例2: resolve
void DNS::resolve( struct addrinfo** res, const std::string& service, const std::string& proto,
const std::string& domain, const LogSink& logInstance )
{
logInstance.dbg( LogAreaClassDns, "Resolving: _" + service + "._" + proto + "." + domain );
struct addrinfo hints;
if( proto == "tcp" )
hints.ai_socktype = SOCK_STREAM;
else if( proto == "udp" )
hints.ai_socktype = SOCK_DGRAM;
else
{
logInstance.err( LogAreaClassDns, "Unknown/Invalid protocol: " + proto );
}
memset( &hints, '\0', sizeof( hints ) );
hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME;
hints.ai_socktype = SOCK_STREAM;
int e = getaddrinfo( domain.c_str(), service.c_str(), &hints, res );
if( e )
logInstance.err( LogAreaClassDns, "getaddrinfo() failed" );
}