blob: fe749ece2aebe164ae58e4076e278588e6b6a20f [file] [log] [blame]
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "json/json.h"
#include "lynq_deflog.h"
int main(int argc, char *argv[])
{
int err, value;
int cmdIdx = 0;
int ret = 0;
int i = 0;
char operator[10];
int opt = 0;
const char * module_name = "MBTK_QL_TEST";
log_level_enum *level = -1;
lynq_log_configuration_init("MBTK_QL_TEST");
while(1)
{
printf("=========log========\n"
"\t 0 lynq_syslog_set_file_size\n"
"\t 1 lynq_syslog_get_file_size\n"
"\t 2 lynq_syslog_set_file_rotate\n"
"\t 3 lynq_syslog_get_file_rotate\n"
"\t 4 lynq_set_log_level\n"
"\t 5 lynq_get_log_level\n"
"\t 6 test write log\n"
"\t 7 EXIT \n"
"=========================\n");
fflush(stdin);
fgets(operator, sizeof(operator), stdin);
opt = atoi(operator);
switch(opt)
{
case 0://"lynq_syslog_set_file_size"
{
//fgets(arg_string, MAX_INPUT, stdin);
printf("please input size:\n");
scanf("%d", &value);
printf("Input value is %d\n",value);
ret = lynq_syslog_set_file_size(value);
if(ret < 0)
{
printf("lynq_syslog_set_file_size failed, ret=%d\n", ret);
}
break;
}
case 1://"lynq_syslog_get_file_size"
{
//ret = demo_lynq_syslog_get_file_size();
ret = lynq_syslog_get_file_size();
printf("lynq_syslog_get_file_size ret:%d!\n", ret);
break;
}
case 2://"lynq_syslog_set_file_rotate"
{
printf("please input count:\n");
scanf("%d", &value);
printf("Input value is %d\n",value);
ret = lynq_syslog_set_file_rotate(value);
if(ret < 0)
{
printf("lynq_syslog_set_file_rotate failed, ret=%d\n", ret);
}
break;
}
case 3://"lynq_syslog_get_file_rotate"
{
ret = lynq_syslog_get_file_rotate();
printf("lynq_syslog_get_file_rotate ret:%d!\n", ret);
break;
}
case 4://"lynq_set_log_level"
{
printf("please input level:\n");
scanf("%d", &value);
ret = lynq_set_log_level(module_name, value);
printf("lynq_set_log_level ret:%d!\n", ret);
break;
}
case 5://"lynq_get_log_level"
{
ret = lynq_get_log_level(module_name, &level);
printf("lynq_get_log_level ret:%d, level:%d!\n", ret, level);
break;
}
case 6://test write log
{
for(i=0;i<10;i++)
{
LYVERBLOG("LYNQ: Test LYVERBLOG\n");
LYERRLOG("LYNQ: Test LYERRLOG\n");
LYWARNLOG("LYNQ: Test LYWARNLOG\n");
LYINFLOG("LYNQ: Test LYINFLOG\n");
LYDBGLOG("LYNQ: Test LYDBGLOG\n");
}
printf("test write log end\n");
break;
}
default://EXIT
{
printf("break\n");
return 0;
}
}
}
return 0;
}