Commit e11728a8 authored by Cedric Roux's avatar Cedric Roux

- make it work with oaisim

- add global ON/OFF command line options (OFF is useless but just for
  completeness)
parent 9e083707
......@@ -69,6 +69,22 @@ ID = LEGACY_S1AP_TRACE
DESC = S1AP legacy logs - trace level
GROUP = S1AP:TRACE:LEGACY
ID = LEGACY_X2AP_INFO
DESC = X2AP legacy logs - info level
GROUP = X2AP:INFO:LEGACY
ID = LEGACY_X2AP_ERROR
DESC = X2AP legacy logs - error level
GROUP = X2AP:ERROR:LEGACY
ID = LEGACY_X2AP_WARNING
DESC = X2AP legacy logs - warning level
GROUP = X2AP:WARNING:LEGACY
ID = LEGACY_X2AP_DEBUG
DESC = X2AP legacy logs - debug level
GROUP = X2AP:DEBUG:LEGACY
ID = LEGACY_X2AP_TRACE
DESC = X2AP legacy logs - trace level
GROUP = X2AP:TRACE:LEGACY
ID = LEGACY_RRC_INFO
DESC = RRC legacy logs - info level
GROUP = RRC:INFO:LEGACY
......@@ -245,6 +261,38 @@ ID = LEGACY_OCG_TRACE
DESC = OCG legacy logs - trace level
GROUP = OCG:TRACE:LEGACY
ID = LEGACY_OCM_INFO
DESC = OCM legacy logs - info level
GROUP = OCM:INFO:LEGACY
ID = LEGACY_OCM_ERROR
DESC = OCM legacy logs - error level
GROUP = OCM:ERROR:LEGACY
ID = LEGACY_OCM_WARNING
DESC = OCM legacy logs - warning level
GROUP = OCM:WARNING:LEGACY
ID = LEGACY_OCM_DEBUG
DESC = OCM legacy logs - debug level
GROUP = OCM:DEBUG:LEGACY
ID = LEGACY_OCM_TRACE
DESC = OCM legacy logs - trace level
GROUP = OCM:TRACE:LEGACY
ID = LEGACY_OIP_INFO
DESC = OIP legacy logs - info level
GROUP = OIP:INFO:LEGACY
ID = LEGACY_OIP_ERROR
DESC = OIP legacy logs - error level
GROUP = OIP:ERROR:LEGACY
ID = LEGACY_OIP_WARNING
DESC = OIP legacy logs - warning level
GROUP = OIP:WARNING:LEGACY
ID = LEGACY_OIP_DEBUG
DESC = OIP legacy logs - debug level
GROUP = OIP:DEBUG:LEGACY
ID = LEGACY_OIP_TRACE
DESC = OIP legacy logs - trace level
GROUP = OIP:TRACE:LEGACY
ID = LEGACY_OMG_INFO
DESC = OMG legacy logs - info level
GROUP = OMG:INFO:LEGACY
......
......@@ -304,8 +304,15 @@ static void onoff_group(database *d, char *name, int *a, int onoff)
for (i = 0; i < g->size; i++) onoff_id(d, g->ids[i], a, onoff);
}
void on_off(void *d, char *item, int *a, int onoff)
void on_off(void *_d, char *item, int *a, int onoff)
{
database *d = _d;
int i;
if (item == NULL) {
for (i = 0; i < d->isize; i++) a[i] = onoff;
printf("turning %s all traces\n", onoff ? "ON" : "OFF");
return;
}
onoff_group(d, item, a, onoff);
onoff_id(d, item, a, onoff);
}
......@@ -172,6 +172,11 @@ void get_message(int s)
case T_LEGACY_OCG_WARNING: S("OCG", "WARNING"); break;
case T_LEGACY_OCG_DEBUG: S("OCG", "DEBUG"); break;
case T_LEGACY_OCG_TRACE: S("OCG", "TRACE"); break;
case T_LEGACY_OCM_INFO: S("OCM", "INFO"); break;
case T_LEGACY_OCM_ERROR: S("OCM", "ERROR"); break;
case T_LEGACY_OCM_WARNING: S("OCM", "WARNING"); break;
case T_LEGACY_OCM_DEBUG: S("OCM", "DEBUG"); break;
case T_LEGACY_OCM_TRACE: S("OCM", "TRACE"); break;
case T_LEGACY_OMG_INFO: S("OMG", "INFO"); break;
case T_LEGACY_OMG_ERROR: S("OMG", "ERROR"); break;
case T_LEGACY_OMG_WARNING: S("OMG", "WARNING"); break;
......@@ -353,7 +358,9 @@ void usage(void)
" -x run with XFORMS (revisited)\n"
" -on <GROUP or ID> turn log ON for given GROUP or ID\n"
" -off <GROUP or ID> turn log OFF for given GROUP or ID\n"
"note: you may pass several -on and -off, they will be processed in order\n"
" -ON turn all logs ON\n"
" -OFF turn all logs OFF\n"
"note: you may pass several -on/-off/-ON/-OFF, they will be processed in order\n"
" by default, all is off\n"
);
exit(1);
......@@ -393,6 +400,10 @@ int main(int n, char **v)
on_off_name[on_off_n]=v[++i]; on_off_action[on_off_n++]=1; continue; }
if (!strcmp(v[i], "-off")) { if (i > n-2) usage();
on_off_name[on_off_n]=v[++i]; on_off_action[on_off_n++]=0; continue; }
if (!strcmp(v[i], "-ON"))
{ on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=1; continue; }
if (!strcmp(v[i], "-OFF"))
{ on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=0; continue; }
printf("ERROR: unknown option %s\n", v[i]);
usage();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment