本文整理汇总了C++中Log_info函数的典型用法代码示例。如果您正苦于以下问题:C++ Log_info函数的具体用法?C++ Log_info怎么用?C++ Log_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Log_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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
}));
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}