예제 #1
0
void
aim_log_vcommon(aim_log_t* l, aim_log_flag_t flag,
                aim_ratelimiter_t* rl, uint64_t time,
                const char* fname, const char* file, int line,
                const char* fmt, va_list vargs)
{
    const char* color = NULL;

    if(flag == AIM_LOG_FLAG_MSG || flag == AIM_LOG_FLAG_FATAL ||
       aim_log_enabled(l, flag)) {
        if(rl == NULL || aim_ratelimiter_limit(rl, time) == 0) {

            if(aim_pvs_isatty(l->pvs) == 1) {
                if((color = aim_log_flag_color__(flag))) {
                    aim_printf(l->pvs, color);
                }
            }

            aim_log_output__(l, fname, file, line, fmt, vargs);

            if(color) {
                aim_printf(l->pvs, color_reset__);
            }
        }
    }
}
예제 #2
0
파일: upcall.c 프로젝트: mchalla/ivs
static void *
ind_ovs_upcall_thread_main(void *arg)
{
    struct ind_ovs_upcall_thread *thread = arg;

    while (!thread->finished) {
        struct epoll_event events[128];
        thread->log_upcalls = aim_log_enabled(AIM_LOG_STRUCT_POINTER, AIM_LOG_FLAG_VERBOSE);
        int n = epoll_wait(thread->epfd, events, AIM_ARRAYSIZE(events),
                           1000 /* check finished flag once per second */);
        if (n < 0 && errno != EINTR) {
            LOG_ERROR("epoll_wait failed: %s", strerror(errno));
            abort();
        } else if (n > 0) {
            int j;
            for (j = 0; j < n; j++) {
                ind_ovs_handle_port_upcalls(thread, events[j].data.ptr);
            }
        }
    }

    return NULL;
}