本文整理汇总了C++中set_log_level函数的典型用法代码示例。如果您正苦于以下问题:C++ set_log_level函数的具体用法?C++ set_log_level怎么用?C++ set_log_level使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_log_level函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_log_level
void LogStream::set_stream(TextOutput out) {
// temporarily disable writes, otherwise at log level MEMORY the log is
// displayed using the old out_ object, which is in the process of being
// freed (generally this leads to a segfault)
LogLevel old = get_log_level();
set_log_level(SILENT);
out_ = out;
set_log_level(old);
}
示例2: edit_control
static void edit_control(struct v4l2_camera *cam)
{
struct v4l2_control ctrl;
int cur_level = get_log_level();
int c;
set_log_level(DEBUG);
camera_query_support_control(cam);
scanf("%d%x%d", &c, &ctrl.id, &ctrl.value);
if (c == 1)
camera_set_control(cam, &ctrl);
else
camera_get_control(cam, &ctrl);
LOGI("%d\n", ctrl.value);
set_log_level(cur_level);
}
示例3: main
int main(int argc, char **argv) {
int debug = 0;
int cgb_mode = 1;
//char file_name[1024] = "sdmc:/rom.gb";
char file_name[1024];
if (!selectFile(&cgb_mode, file_name)) {
cleanup();
return 0;
};
ClientOrServer cs = NO_CONNECT;
set_log_level(LOG_INFO);
if (!init_emu(file_name, debug, !cgb_mode, cs)) {
log_message(LOG_ERROR, "Failed to initialize emulator\n");
cleanup();
return 1;
}
log_message(LOG_INFO, "Running emu\n");
run();
write_SRAM();
cleanup();
return 0;
}
示例4: test_learner
void test_learner() {
set_log_level(NONE);
init_store();
_node_count = 4;
recv_from = &recv_from_scenario;
send_to = &send_to_scenario;
sendidx = recvidx = 0;
recv = learner_basic_recv;
send = learner_basic_send;
intheory_sm(LEARNER);
sendidx = recvidx = 0;
recv = learner_getfail_recv;
send = learner_getfail_send;
intheory_sm(LEARNER);
sendidx = recvidx = 0;
recv = learner_expand_recv;
send = learner_expand_send;
intheory_sm(LEARNER);
sendidx = recvidx = 0;
recv = learner_mixed_recv;
send = learner_mixed_send;
intheory_sm(LEARNER);
}
示例5: quote_log
/* SET LOG */
static void
quote_log( struct Client *source_p, int newval )
{
const char *log_level_as_string;
if (newval >= 0)
{
if (newval < L_WARN)
{
sendto_one(source_p, ":%s NOTICE %s :LOG must be > %d (L_WARN)",
me.name, source_p->name, L_WARN);
return;
}
if (newval > L_DEBUG)
{
newval = L_DEBUG;
}
set_log_level(newval);
log_level_as_string = get_log_level_as_string(newval);
sendto_realops_flags(UMODE_ALL, L_ALL,"%s has changed LOG level to %i (%s)",
source_p->name, newval, log_level_as_string);
}
else
{
sendto_one(source_p, ":%s NOTICE %s :LOG level is currently %i (%s)",
me.name, source_p->name, get_log_level(),
get_log_level_as_string(get_log_level()));
}
}
示例6: init_dtls
void
init_dtls(session_t *dst) {
PRINTF("DTLS client started\n");
print_local_addresses();
dst->size = sizeof(dst->addr) + sizeof(dst->port);
dst->port = UIP_HTONS(20220);
set_connection_address(&dst->addr);
client_conn = udp_new(&dst->addr, 0, NULL);
udp_bind(client_conn, dst->port);
PRINTF("set connection address to ");
PRINT6ADDR(&dst->addr);
PRINTF(":%d\n", uip_ntohs(dst->port));
set_log_level(LOG_DEBUG);
dtls_context = dtls_new_context(client_conn);
if (dtls_context) {
dtls_set_psk(dtls_context, (unsigned char *)"secretPSK", 9,
(unsigned char *)"Client_identity", 15);
dtls_set_cb(dtls_context, read_from_peer, read);
dtls_set_cb(dtls_context, send_to_peer, write);
}
}
示例7: main
int main(int argc, char **argv) {
set_log_level(Logger::LEVEL_MIN);
if (argc != 2) {
usage(argc, argv);
return EXIT_FAILURE;
}
char *input_folder = argv[1];
if (!file_exists(input_folder)) {
printf("input_folder[%s] not exists!\n", input_folder);
return EXIT_FAILURE;
}
leveldb::DB *db;
leveldb::Options options;
auto status = leveldb::DB::Open(options, input_folder, &db);
if (!status.ok()) {
printf("open leveldb: %s error!\n", input_folder);
return EXIT_FAILURE;
}
char space[sizeof(TMsg)];
auto read_opts = leveldb::ReadOptions();
read_opts.fill_cache = false;
leveldb::Iterator *it = db->NewIterator(read_opts);
for (it->SeekToFirst(); it->Valid(); it->Next()) {
TMsg *msg = TMsg::TryParse(it, space);
if (msg) {
std::cout << *msg << std::endl;
msg->~TMsg();
}
}
delete db;
return EXIT_SUCCESS;
}
示例8: init_dtls
void
init_dtls(session_t *dst) {
static dtls_handler_t cb = {
.write = send_to_peer,
.read = read_from_peer,
.event = NULL,
.get_key = get_key
};
PRINTF("DTLS client started\n");
print_local_addresses();
dst->size = sizeof(dst->addr) + sizeof(dst->port);
dst->port = UIP_HTONS(20220);
set_connection_address(&dst->addr);
client_conn = udp_new(&dst->addr, 0, NULL);
udp_bind(client_conn, dst->port);
PRINTF("set connection address to ");
PRINT6ADDR(&dst->addr);
PRINTF(":%d\n", uip_ntohs(dst->port));
set_log_level(LOG_DEBUG);
dtls_context = dtls_new_context(client_conn);
if (dtls_context)
dtls_set_handler(dtls_context, &cb);
}
示例9: test_log_all
s32 test_log_all(u32 argc, char **argv)
{
s32 ret = 0;
u32 i, arg1;
i = atoi(argv[2]);
arg1 = atoi(argv[3]);
switch(i) {
case (0):
arg1 = arg1 > LOG_MAX ? LOG_MAX : arg1;
PRINT_EMG("set loglevel [%s]\n", loglevel_desc[arg1]);
ret = set_log_level(arg1);
break;
case (1):
log(LOG_EMG, "%d: %s\n", __LINE__, "hello, world!");
log(LOG_ERR, "%d: %s\n", __LINE__, "hello, world!");
log(LOG_WARN, "%d: %s\n", __LINE__, "hello, world!");
log(LOG_INFO, "%d: %s\n", __LINE__, "hello, world!");
log(LOG_DEBUG, "%d: %s\n", __LINE__, "hello, world!");
break;
default:
return -1;
}
return ret;
}
示例10: main
int main(int argc, char **args) {
if (argc < 5) {
printf("Usage: %s LOCAL_ADDRESS:LOCAL_PORT second_node:port third_node:port fourth_node:port ...\n", args[0]);
printf(" ex: %s 10.0.0.1:4321 10.0.0.2:4321 10.0.0.3:4321 10.0.0.4:4321 ...\n", args[0]);
return 1;
}
set_log_level(GRAPH);
char * all_nodes[argc - 1];
all_nodes[0] = args[1];
int i = 1;
for (; i < argc; i++) {
all_nodes[i] = args[i + 1];
}
start_intheory(0, argc - 1, all_nodes);
register_changed_cb(SLOT, got_hello);
printf("MY ID: %d\n", my_id());
if (my_id() == 0) {
printf("I guess I'm the designated hello-er! Start your nodes!\n");
sleep(5);
say_hello();
}
while (hellos_received < 1) { sleep(1); }
stop_intheory();
return 0;
}
示例11: set_log_level
void
Logger::incr_log_level(LogLevel level)
{
if (get_log_level() < level)
{
set_log_level(level);
}
}
示例12: main
int main()
{
printf("%cwhat\n", 0x20);
set_log_level(5);
log_info("what");
sleep(1);
return 0;
}
示例13: reset
void SetLogState::set(LogLevel l) {
reset();
if (l != DEFAULT) {
level_ = get_log_level();
set_log_level(l);
} else {
level_ = DEFAULT;
}
}
示例14: parse_commandline
/** Uses getopt() to parse the command line and set configuration values
*/
void parse_commandline(int argc, char **argv) {
int c;
int i;
s_config *config = config_get_config();
while (-1 != (c = getopt(argc, argv, "c:hfd:sw:vi:"))) {
switch(c) {
case 'h':
usage();
exit(1);
break;
case 'c':
if (optarg) {
strncpy(config->configfile, optarg, sizeof(config->configfile));
}
break;
case 'w':
if (optarg) {
free(config->ndsctl_sock);
config->ndsctl_sock = safe_strdup(optarg);
}
break;
case 'f':
config->daemon = 0;
break;
case 'd':
if (optarg) {
set_log_level(atoi(optarg));
}
break;
case 's':
config->log_syslog = 1;
break;
case 'v':
printf("This is nodogsplash version " VERSION "\n");
exit(1);
break;
default:
usage();
exit(1);
break;
}
}
}
示例15: getenv
int TraceLog::get_log_level()
{
if (!got_env_)
{
const char *log_level_str = getenv(LOG_LEVEL_ENV_KEY);
set_log_level(log_level_str);
}
return log_level_;
}