示例#1
0
int main(int argc, char **argv)
{
    logpool_global_init(LOGPOOL_TRACE);
    logpool_t *logpool = logpool_open(NULL, &LOGAPI, LOGAPI_PARAM);
    void *logpool_args;
    if (argc < 2) {
        fprintf(stderr, "usage: %s key value key value ...\n", argv[0]);
        goto L_error;
    }
    switch (argc) {
        case 3:
            logpool_record(logpool, &logpool_args, LOG_NOTICE, "logput",
                    KEYVALUE_s(argv[1], argv[2]),
                    LOG_END);
            break;
        case 5:
            logpool_record(logpool, &logpool_args, LOG_NOTICE, "logput",
                    KEYVALUE_s(argv[1], argv[2]),
                    KEYVALUE_s(argv[3], argv[4]),
                    LOG_END);
            break;
        case 7:
            logpool_record(logpool, &logpool_args, LOG_NOTICE, "logput",
                    KEYVALUE_s(argv[1], argv[2]),
                    KEYVALUE_s(argv[3], argv[4]),
                    KEYVALUE_s(argv[5], argv[6]),
                    LOG_END);
            break;
        case 9:
            logpool_record(logpool, &logpool_args, LOG_NOTICE, "logput",
                    KEYVALUE_s(argv[1], argv[2]),
                    KEYVALUE_s(argv[3], argv[4]),
                    KEYVALUE_s(argv[5], argv[6]),
                    KEYVALUE_s(argv[6], argv[8]),
                    LOG_END);

            break;
    }
    logpool_close(logpool);
    logpool_global_exit();
    return 0;
L_error:;
    logpool_close(logpool);
    logpool_global_exit();
    return 1;
}
示例#2
0
static void logpool_test_Write1(logpool_t *logpool)
{
    double f = 3.14;
    long   i = 128;
    const char *s = "hello world";
    logpool_record(logpool, NULL, LOG_NOTICE, "event",
            KEYVALUE_f("float", f),
            KEYVALUE_i("int",   i),
            LogText("string", s),
            LOG_END
            );
}
示例#3
0
static void logpool_test_Write(logpool_t *logpool)
{
    long   i = n;
    const char *s = "Good Bye";
    void *args;
    logpool_record(logpool, &args, LOG_NOTICE, "check",
                   LogText("string", s),
                   LogUint("tid",   i%10),
                   LOG_END
                  );
    n++;
}
示例#4
0
static void logpool_test_write(logpool_t *logpool)
{
    long   i = n;
    const char *s = "Good Bye";
    void *args;
    logpool_record(logpool, &args, LOG_NOTICE, "check",
            KEYVALUE_s("string", s),
            KEYVALUE_u("tid",   i%10),
            LOG_END
            );
    n++;
}
示例#5
0
static void logpool_test_write0(logpool_t *logpool)
{
    double f = 3.14;
    long   i = 128;
    const char *s = "hello world";
    logpool_record(logpool, NULL, LOG_INFO, "event",
            KEYVALUE_f("float", f),
            KEYVALUE_i("int",   i),
            KeyValue_s("string", s),
            LOG_END
            );
}
示例#6
0
static void logpool_test_write(logpool_t *logpool)
{
    long   i = n;
    const char *s = "hello world";
    void *args;
    logpool_record(logpool, &args, LOG_NOTICE, "event",
            KeyValue_u("uint",   i),
            KeyValue_u("tid",   i/10),
            KeyValue_s("string", s),
            LOG_END
            );
    n++;

}
示例#7
0
static void logpool_test_write(logpool_t *logpool)
{
    double f = 3.14;
    long   i = 128;
    const char *s = "hello world";
    logpool_record(logpool, NULL, LOG_NOTICE, "event",
            KEYVALUE_f("0:float", f),
            KEYVALUE_i("0:int",   i),
            LogText("0:string", s),
            KEYVALUE_f("1:float", f),
            KEYVALUE_i("1:int",   i),
            LogText("1:string", s),
            KEYVALUE_f("2:float", f),
            KEYVALUE_i("2:int",   i),
            LogText("2:string", s),
            KEYVALUE_f("3:float", f),
            KEYVALUE_i("3:int",   i),
            LogText("3:string", s),
            KEYVALUE_f("4:float", f),
            KEYVALUE_i("4:int",   i),
            LogText("4:string", s),
            KEYVALUE_f("5:float", f),
            KEYVALUE_i("5:int",   i),
            LogText("5:string", s),
            KEYVALUE_f("6:float", f),
            KEYVALUE_i("6:int",   i),
            LogText("6:string", s),
            KEYVALUE_f("7:float", f),
            KEYVALUE_i("7:int",   i),
            LogText("7:string", s),
            KEYVALUE_f("8:float", f),
            KEYVALUE_i("8:int",   i),
            LogText("8:string", s),
            KEYVALUE_f("9:float", f),
            KEYVALUE_i("9:int",   i),
            LogText("9:string", s),
            LOG_END
            );
}