本文整理汇总了C++中Log_info函数的典型用法代码示例。如果您正苦于以下问题:C++ Log_info函数的具体用法?C++ Log_info怎么用?C++ Log_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Log_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: checkIPversions
/* Check which IP versions are supported by the system. */
void checkIPversions()
{
int testsocket = -1;
testsocket = socket(PF_INET, SOCK_STREAM, 0);
hasv4 = (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) ? false : true;
if (!(testsocket < 0)) close(testsocket);
testsocket = socket(PF_INET6, SOCK_STREAM, 0);
hasv6 = (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) ? false : true;
if (!(testsocket < 0)) close(testsocket);
if(!hasv4)
{
Log_info("IPv4 is not supported by this system");
nofServerSocks -= 2;
}
if(!hasv6)
{
Log_info("IPv6 is not supported by this system");
nofServerSocks -= 2;
}
if(nofServerSocks == 0)
{
Log_fatal("Neither IPv4 nor IPv6 are supported by this system");
}
}
开发者ID:Nauxuron,项目名称:umurmur,代码行数:29,代码来源:server.c
示例2: get
static int get(struct RandomSeed* rs, uint64_t buffer[8])
{
struct RandomSeed_pvt* ctx = Identity_check((struct RandomSeed_pvt*) rs);
Log_info(ctx->logger, "Attempting to seed random number generator");
// each provider overwrites input and output is a rolling hash.
struct RandomSeed_Buffer buff = { .output = {0} };
int successCount = 0;
for (int i = 0; i < ctx->rsCount; i++) {
if (!ctx->rsList[i]->get(ctx->rsList[i], buff.input)) {
Log_info(ctx->logger, "Trying random seed [%s] Success", ctx->rsList[i]->name);
crypto_hash_sha512((uint8_t*)buff.output,
(uint8_t*)&buff,
RandomSeed_Buffer_SIZE);
successCount++;
} else {
Log_info(ctx->logger, "Trying random seed [%s] Failed", ctx->rsList[i]->name);
}
}
Assert_true(sizeof(buff.output) == 64);
Bits_memcpy(buffer, buff.output, 64);
if (successCount > 0) {
Log_info(ctx->logger, "Seeding random number generator succeeded with [%d] sources",
successCount);
return 0;
} else {
Log_error(ctx->logger, "Seeding random number generator failed");
return -1;
}
}
开发者ID:DmytroOrlov,项目名称:cjdns,代码行数:32,代码来源:RandomSeed.c
示例3: authorizedPasswords
static void authorizedPasswords(List* list, struct Context* ctx)
{
uint32_t count = List_size(list);
for (uint32_t i = 0; i < count; i++) {
Dict* d = List_getDict(list, i);
Log_info(ctx->logger, "Checking authorized password %d.", i);
if (!d) {
Log_critical(ctx->logger, "Not a dictionary type %d.", i);
exit(-1);
}
String* passwd = Dict_getString(d, String_CONST("password"));
if (!passwd) {
Log_critical(ctx->logger, "Must specify a password %d.", i);
exit(-1);
}
}
Log_info(ctx->logger, "Flushing existing authorized passwords");
rpcCall(String_CONST("AuthorizedPasswords_flush"), NULL, ctx, ctx->alloc);
for (uint32_t i = 0; i < count; i++) {
Dict* d = List_getDict(list, i);
String* passwd = Dict_getString(d, String_CONST("password"));
Log_info(ctx->logger, "Adding authorized password #[%d].", i);
Dict args = Dict_CONST(
String_CONST("authType"), Int_OBJ(1), Dict_CONST(
String_CONST("password"), String_OBJ(passwd), NULL
));
struct Allocator* child = ctx->alloc->child(ctx->alloc);
rpcCall(String_CONST("AuthorizedPasswords_add"), &args, ctx, child);
child->free(child);
}
}
开发者ID:TrueShiftBlue,项目名称:cjdns,代码行数:34,代码来源:Configurator.c
示例4: Server_run
void Server_run()
{
struct pollfd *pollfds;
checkIPversions();
/* max clients + server sokets + client connecting that will be disconnected */
pollfds = Memory_safeCalloc((getIntConf(MAX_CLIENTS) + nofServerSocks + 1) , sizeof(struct pollfd));
/* Figure out bind address and port */
struct sockaddr_storage** addresses = Server_setupAddressesAndPorts();
/* Prepare TCP sockets */
Server_setupTCPSockets(addresses, pollfds);
/* Prepare UDP sockets */
Server_setupUDPSockets(addresses, pollfds);
Log_info("uMurmur version %s ('%s') protocol version %d.%d.%d",
UMURMUR_VERSION, UMURMUR_CODENAME, PROTVER_MAJOR, PROTVER_MINOR, PROTVER_PATCH);
Log_info("Visit http://code.google.com/p/umurmur/");
/* Main server loop */
Server_runLoop(pollfds);
/* Disconnect clients and cleanup memory */
Client_disconnect_all();
free(pollfds);
free(addresses[0]);
free(addresses[1]);
free(addresses);
free(udpsocks);
}
开发者ID:Nauxuron,项目名称:umurmur,代码行数:33,代码来源:server.c
示例5: Engine_print_hardware_info
void Engine_print_hardware_info()
{
// Print graphics info.
const GLubyte* renderer = glGetString(GL_RENDERER);
const GLubyte* version = glGetString(GL_VERSION);
Log_info("Renderer: %s", renderer);
Log_info("OpenGL version supported %s\n", version);
}
开发者ID:mikehenrty,项目名称:opengl-learning,代码行数:8,代码来源:engine.c
示例6: AdminTestFramework_setUp
struct AdminTestFramework* AdminTestFramework_setUp(int argc, char** argv, char* testName)
{
if (argc > 2 && !strcmp(testName, argv[1]) && !strcmp("angel", argv[2])) {
exit(AngelInit_main(argc-1, &argv[1]));
}
struct Allocator* alloc = MallocAllocator_new(1<<20);
struct Writer* logwriter = FileWriter_new(stdout, alloc);
Assert_true(logwriter);
struct Log* logger = WriterLog_new(logwriter, alloc);
struct EventBase* eventBase = EventBase_new(alloc);
struct Random* rand = Random_new(alloc, logger, NULL);
char asClientPipeName[32] = {0};
Random_base32(rand, (uint8_t*)asClientPipeName, 31);
struct Pipe* asClientPipe = Pipe_named(asClientPipeName, eventBase, NULL, alloc);
asClientPipe->logger = logger;
char asCorePipeName[32] = {0};
Random_base32(rand, (uint8_t*)asCorePipeName, 31);
struct Pipe* asCorePipe = Pipe_named(asCorePipeName, eventBase, NULL, alloc);
asCorePipe->logger = logger;
struct Interface* asCoreIface = FramingInterface_new(65535, &asCorePipe->iface, alloc);
spawnAngel(testName, asClientPipeName, eventBase, alloc);
Log_info(logger, "Initializing Angel");
initAngel(asClientPipe, asCoreIface, (char*)asCorePipe->name, eventBase, logger, alloc, rand);
struct Sockaddr_storage addr;
Assert_true(!Sockaddr_parse("127.0.0.1", &addr));
Log_info(logger, "Binding UDP admin socket");
struct AddrInterface* udpAdmin =
UDPAddrInterface_new(eventBase, &addr.addr, alloc, NULL, logger);
String* password = String_new("abcd", alloc);
struct Admin* admin = Admin_new(udpAdmin, alloc, logger, eventBase, password);
// Now setup the client.
struct AdminClient* client =
AdminClient_new(udpAdmin->addr, password, eventBase, logger, alloc);
Assert_true(client);
return Allocator_clone(alloc, (&(struct AdminTestFramework) {
.admin = admin,
.client = client,
.alloc = alloc,
.eventBase = eventBase,
.logger = logger,
.addr = Sockaddr_clone(udpAdmin->addr, alloc),
.angelInterface = asCoreIface
}));
开发者ID:AVert,项目名称:cjdns,代码行数:58,代码来源:AdminTestFramework.c
示例7: onAngelExitResponse
static void onAngelExitResponse(Dict* message, void* vcontext)
{
struct Context* context = vcontext;
Log_info(context->logger, "Angel stopped");
Log_info(context->logger, "Exiting");
Dict d = Dict_CONST(String_CONST("error"), String_OBJ(String_CONST("none")), NULL);
Admin_sendMessage(&d, context->exitTxid, context->admin);
exit(0);
}
开发者ID:Kingofhearts102,项目名称:cjdns,代码行数:9,代码来源:Core.c
示例8: onAngelExitResponse
static void onAngelExitResponse(Dict* message, void* vcontext)
{
struct Context* context = vcontext;
Log_info(context->logger, "Angel stopped");
Log_info(context->logger, "Exiting");
Dict d = Dict_CONST(String_CONST("error"), String_OBJ(String_CONST("none")), NULL);
Admin_sendMessage(&d, context->exitTxid, context->admin);
Timeout_setTimeout(shutdown, context, 1, context->base, context->allocator);
}
开发者ID:AdUser,项目名称:cjdns,代码行数:9,代码来源:Core.c
示例9: signal_handler
void signal_handler(int sig)
{
switch(sig) {
case SIGHUP:
Log_info("HUP signal received.");
Log_reset();
break;
case SIGTERM:
Log_info("TERM signal. Shutting down.");
Server_shutdown();
break;
}
}
开发者ID:rindeal,项目名称:umurmur,代码行数:13,代码来源:main.c
示例10: adminExit
static void adminExit(Dict* input, void* vcontext, String* txid, struct Allocator* requestAlloc)
{
struct Context* context = vcontext;
Log_info(context->logger, "Got request to exit");
Log_info(context->logger, "Stopping angel");
context->exitTxid = String_clone(txid, context->allocator);
Dict angelExit = Dict_CONST(String_CONST("q"), String_OBJ(String_CONST("Angel_exit")), NULL);
Hermes_callAngel(&angelExit,
onAngelExitResponse,
context,
context->allocator,
NULL,
context->hermes);
}
开发者ID:AdUser,项目名称:cjdns,代码行数:14,代码来源:Core.c
示例11: handle_var_request
static int handle_var_request(struct upnp_device *priv,
struct Upnp_State_Var_Request *var_event) {
struct service *srv = find_service(priv->upnp_device_descriptor,
var_event->ServiceID);
if (srv == NULL) {
var_event->ErrCode = UPNP_SOAP_E_INVALID_ARGS;
return -1;
}
ithread_mutex_lock(srv->service_mutex);
char *result = NULL;
const int var_count =
VariableContainer_get_num_vars(srv->variable_container);
for (int i = 0; i < var_count; ++i) {
const char *name;
const char *value =
VariableContainer_get(srv->variable_container, i, &name);
if (value && strcmp(var_event->StateVarName, name) == 0) {
result = strdup(value);
break;
}
}
ithread_mutex_unlock(srv->service_mutex);
var_event->CurrentVal = result;
var_event->ErrCode = (result == NULL)
? UPNP_SOAP_E_INVALID_VAR
: UPNP_E_SUCCESS;
Log_info("upnp", "Variable request %s -> %s (%s)",
var_event->StateVarName, result, var_event->ServiceID);
return 0;
}
开发者ID:Arazlin,项目名称:gmrender-resurrect,代码行数:34,代码来源:upnp_device.c
示例12: sendMessage
static uint8_t sendMessage(struct Message* message, struct Interface* iface)
{
struct UDPAddrInterface_pvt* context =
Identity_cast((struct UDPAddrInterface_pvt*) iface->senderContext);
struct Sockaddr_storage addrStore;
Message_pop(message, &addrStore, context->pub.addr->addrLen);
Assert_true(addrStore.addr.addrLen == context->pub.addr->addrLen);
if (Socket_sendto(context->socket,
message->bytes,
message->length,
0,
&addrStore.addr) < 0)
{
switch (Errno_get()) {
case Errno_EMSGSIZE:
return Error_OVERSIZE_MESSAGE;
case Errno_ENOBUFS:
case Errno_EAGAIN:
return Error_LINK_LIMIT_EXCEEDED;
default:;
Log_info(context->logger, "Got error sending to socket [%s]",
Errno_getString());
}
}
return 0;
}
开发者ID:CSRedRat,项目名称:cjdns,代码行数:30,代码来源:UDPAddrInterface.c
示例13: queryMsg
static Iface_DEFUN queryMsg(struct MsgCore_pvt* mcp,
Dict* content,
struct Address* src,
struct Message* msg)
{
String* q = Dict_getStringC(content, "q");
struct QueryHandler* qh = NULL;
for (int i = 0; i < mcp->qh->length; i++) {
struct QueryHandler* qhx = ArrayList_OfQueryHandlers_get(mcp->qh, i);
Identity_check(qhx);
if (String_equals(qhx->queryType, q)) {
qh = qhx;
break;
}
}
if (!qh) {
Log_debug(mcp->log, "Unhandled query type [%s]", q->bytes);
return NULL;
}
if (!qh->pub.cb) {
Log_info(mcp->log, "Query handler for [%s] not setup", q->bytes);
return NULL;
}
qh->pub.cb(content, src, msg->alloc, &qh->pub);
return NULL;
}
开发者ID:sssemil,项目名称:cjdns,代码行数:26,代码来源:MsgCore.c
示例14: upnp_control_init
void upnp_control_init(struct upnp_device *device) {
upnp_control_get_service();
// Set initial volume.
float volume_fraction = 0;
if (output_get_volume(&volume_fraction) == 0) {
Log_info("control", "Output inital volume is %f; setting "
"control variables accordingly.", volume_fraction);
change_volume_decibel(20 * log(volume_fraction) / log(10));
}
assert(control_service_.last_change == NULL);
control_service_.last_change =
UPnPLastChangeCollector_new(state_variables_, CONTROL_EVENT_XML_NS,
device,
CONTROL_SERVICE_ID);
// According to UPnP-av-RenderingControl-v3-Service-20101231.pdf, 2.3.1
// page 51, the A_ARG_TYPE* variables are not evented.
UPnPLastChangeCollector_add_ignore(control_service_.last_change,
CONTROL_VAR_AAT_CHANNEL);
UPnPLastChangeCollector_add_ignore(control_service_.last_change,
CONTROL_VAR_AAT_INSTANCE_ID);
UPnPLastChangeCollector_add_ignore(control_service_.last_change,
CONTROL_VAR_AAT_PRESET_NAME);
}
开发者ID:alinzai,项目名称:audio,代码行数:25,代码来源:upnp_control.c
示例15: NetDev_addAddress
void NetDev_addAddress(const char* ifName,
struct Sockaddr* sa,
int prefixLen,
struct Log* logger,
struct Except* eh)
{
int addrFam = Sockaddr_getFamily(sa);
struct Allocator* alloc;
BufferAllocator_STACK(alloc, 4096);
char* printedAddr = Sockaddr_print(sa, alloc);
if (addrFam != Sockaddr_AF_INET && addrFam != Sockaddr_AF_INET6) {
Except_throw(eh, "Unknown address type for address [%s]", printedAddr);
}
int prefixMax = (addrFam == Sockaddr_AF_INET6) ? 128 : 32;
if (prefixLen < 0 || prefixLen > prefixMax) {
Except_throw(eh, "prefixLen [%d] must be greater than 0 and less than %d",
prefixLen, prefixMax);
}
void* addr;
int len = Sockaddr_getAddress(sa, &addr);
if (len < 0 || len != prefixMax / 8) {
Except_throw(eh, "Invalid sockaddr [%s]", printedAddr);
}
Log_info(logger, "Setting IP address [%s/%d] on interface [%s]",
printedAddr, prefixLen, ifName);
NetPlatform_addAddress(ifName, addr, prefixLen, addrFam, logger, eh);
}
开发者ID:Erkan-Yilmaz,项目名称:cjdns,代码行数:32,代码来源:NetDev.c
示例16: init_logging
static void init_logging(const char *log_file) {
char version[1024];
#ifdef HAVE_GST
snprintf(version, sizeof(version), "[ gmediarender %s "
"(libupnp-%s; glib-%d.%d.%d; gstreamer-%d.%d.%d) ]",
GM_COMPILE_VERSION, UPNP_VERSION_STRING,
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO);
#else
snprintf(version, sizeof(version), "[ gmediarender %s "
"(libupnp-%s; glib-%d.%d.%d; without gstreamer.) ]",
GM_COMPILE_VERSION, UPNP_VERSION_STRING,
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
#endif
if (log_file != NULL) {
Log_init(log_file);
Log_info("main", "%s log started %s", PACKAGE_STRING, version);
} else {
fprintf(stderr, "%s started %s.\nLogging switched off. "
"Enable with --logfile=<filename> "
"(e.g. --logfile=/dev/stdout for console)\n",
PACKAGE_STRING, version);
}
}
开发者ID:DerWaldschrat,项目名称:gmrender-resurrect,代码行数:27,代码来源:main.c
示例17: sendMessageInternal
static void sendMessageInternal(struct Message* message,
struct sockaddr_ll* addr,
struct ETHInterface_pvt* context,
struct Except* exHandler)
{
/* Cut down on the noise
uint8_t buff[sizeof(*addr) * 2 + 1] = {0};
Hex_encode(buff, sizeof(buff), (uint8_t*)addr, sizeof(*addr));
Log_debug(context->logger, "Sending ethernet frame to [%s]", buff);
*/
if (sendto(context->socket,
message->bytes,
message->length,
0,
(struct sockaddr*) addr,
sizeof(struct sockaddr_ll)) < 0)
{
switch (errno) {
default:;
Log_info(context->logger, "[%s] Got error sending to socket [%s]",
context->ifName->bytes, strerror(errno));
Except_throw(exHandler, "Interface %s removed: [%s]",
context->ifName->bytes, strerror(errno));
case EMSGSIZE:
case ENOBUFS:
case EAGAIN:;
// todo: care
}
}
return;
}
开发者ID:wfleurant,项目名称:cjdns,代码行数:33,代码来源:ETHInterface_linux.c
示例18: TUNInterface_new
struct Interface* TUNInterface_new(const char* interfaceName,
char assignedInterfaceName[TUNInterface_IFNAMSIZ],
struct EventBase* base,
struct Log* logger,
struct Except* eh,
struct Allocator* alloc)
{
uint32_t maxNameSize = (IFNAMSIZ < TUNInterface_IFNAMSIZ) ? IFNAMSIZ : TUNInterface_IFNAMSIZ;
Log_info(logger, "Initializing tun device [%s]", ((interfaceName) ? interfaceName : "auto"));
struct ifreq ifRequest = { .ifr_flags = IFF_TUN };
if (interfaceName) {
if (strlen(interfaceName) > maxNameSize) {
Except_throw(eh, "tunnel name too big, limit is [%d] characters", maxNameSize);
}
strncpy(ifRequest.ifr_name, interfaceName, maxNameSize);
}
int fileno = open(DEVICE_PATH, O_RDWR);
if (fileno < 0) {
Except_throw(eh, "open(\"%s\") [%s]", DEVICE_PATH, strerror(errno));
}
if (ioctl(fileno, TUNSETIFF, &ifRequest) < 0) {
int err = errno;
close(fileno);
Except_throw(eh, "ioctl(TUNSETIFF) [%s]", strerror(err));
}
strncpy(assignedInterfaceName, ifRequest.ifr_name, maxNameSize);
struct Pipe* p = Pipe_forFiles(fileno, fileno, base, eh, alloc);
return &p->iface;
}
开发者ID:bitpayclone,项目名称:cjdns,代码行数:34,代码来源:TUNInterface_linux.c
示例19: TUNConfigurator_setMTU
void TUNConfigurator_setMTU(const char* interfaceName,
uint32_t mtu,
struct Log* logger,
struct Except* eh)
{
int s = socket(AF_INET6, SOCK_DGRAM, 0);
if (s < 0) {
Except_raise(eh,
TUNConfigurator_ERROR_GETTING_ADMIN_SOCKET,
"socket() failed [%s]",
Errno_getString());
}
struct ifreq ifRequest;
strncpy(ifRequest.ifr_name, interfaceName, IFNAMSIZ);
ifRequest.ifr_mtu = mtu;
Log_info(logger, "Setting MTU for device [%s] to [%u] bytes.", interfaceName, mtu);
if (ioctl(s, SIOCSIFMTU, &ifRequest) < 0) {
enum Errno err = Errno_get();
close(s);
Except_raise(eh,
TUNConfigurator_setMTU_INTERNAL,
"ioctl(SIOCSIFMTU) failed [%s]",
Errno_strerror(err));
}
}
开发者ID:eblanton,项目名称:cjdns,代码行数:31,代码来源:TUNConfigurator_FreeBSD.c
示例20: setup_sighandler
int setup_sighandler (void (*func) (int) )
{
#ifndef __WIN32__
struct sigaction a;
Log_info ("setting up signal handler");
sigemptyset (&a.sa_mask);
a.sa_flags = 0;
a.sa_handler = func;
sigaction (SIGTERM, &a, 0);
sigaction (SIGINT, &a, 0);
a.sa_handler = SIG_IGN;
sigaction (SIGPIPE, &a, 0);
return 0;
#else //__WIN32__
signal (SIGINT, func);
signal (SIGTERM, func);
//signal (SIGPIPE, SIG_IGN); How comes?
return 0;
#endif
}
开发者ID:BrainDamage,项目名称:CloudVPN,代码行数:25,代码来源:sighandler.cpp
注:本文中的Log_info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论