summaryrefslogtreecommitdiff
path: root/src/adaptor/dlt-adaptor-stdin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/adaptor/dlt-adaptor-stdin.c')
-rw-r--r--src/adaptor/dlt-adaptor-stdin.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/adaptor/dlt-adaptor-stdin.c b/src/adaptor/dlt-adaptor-stdin.c
index f8e8fc0..eae7000 100644
--- a/src/adaptor/dlt-adaptor-stdin.c
+++ b/src/adaptor/dlt-adaptor-stdin.c
@@ -91,11 +91,12 @@ int main(int argc, char* argv[])
char ctid[DLT_ID_SIZE];
char version[255];
int timeout = -1;
+ int verbosity = DLT_LOG_INFO;
dlt_set_id(apid, PS_DLT_APP);
dlt_set_id(ctid, PS_DLT_CONTEXT);
- while ((opt = getopt(argc, argv, "a:c:ht:")) != -1)
+ while ((opt = getopt(argc, argv, "a:c:ht:v:")) != -1)
{
switch (opt)
{
@@ -125,10 +126,50 @@ int main(int argc, char* argv[])
printf(" -a apid - Set application id to apid (default: SINA)\n");
printf(" -c ctid - Set context id to ctid (default: SINC)\n");
printf(" -t timeout - Set timeout when sending messages at exit, in ms (Default: 10000 = 10sec)\n");
+ printf(" -v verbosity level - Set verbosity level (Default: INFO, values: FATAL ERROR WARN INFO DEBUG VERBOSE)\n");
printf(" -h - This help\n");
return 0;
break;
}
+ case 'v':
+ {
+ if(!strcmp(optarg, "FATAL"))
+ {
+ verbosity = DLT_LOG_FATAL;
+ break;
+ }
+ else if(!strcmp(optarg, "ERROR"))
+ {
+ verbosity = DLT_LOG_ERROR;
+ break;
+ }
+ else if(!strcmp(optarg, "WARN"))
+ {
+ verbosity = DLT_LOG_WARN;
+ break;
+ }
+ else if(!strcmp(optarg, "INFO"))
+ {
+ verbosity = DLT_LOG_INFO;
+ break;
+ }
+ else if(!strcmp(optarg, "DEBUG"))
+ {
+ verbosity = DLT_LOG_DEBUG;
+ break;
+ }
+ else if(!strcmp(optarg, "VERBOSE"))
+ {
+ verbosity = DLT_LOG_VERBOSE;
+ break;
+ } else
+ {
+ printf("Wrong verbosity level, setting to INFO. Accepted values are: FATAL ERROR WARN INFO DEBUG VERBOSE\n");
+ verbosity = DLT_LOG_INFO;
+ break;
+ }
+ break;
+ }
default: /* '?' */
{
fprintf(stderr, "Unknown option '%c'\n", optopt);
@@ -148,7 +189,7 @@ int main(int argc, char* argv[])
{
if (strcmp(str,"")!=0)
{
- DLT_LOG(mycontext, DLT_LOG_INFO, DLT_STRING(str));
+ DLT_LOG(mycontext, verbosity, DLT_STRING(str));
}
}