mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Update log_level from uci
This commit is contained in:
parent
a0e6cab227
commit
4eaec4e6d2
1 changed files with 11 additions and 5 deletions
|
|
@ -22,6 +22,7 @@
|
||||||
#define MAX_SERVICE_NUM 16
|
#define MAX_SERVICE_NUM 16
|
||||||
#define MAX_INSTANCE_NUM 8
|
#define MAX_INSTANCE_NUM 8
|
||||||
#define NAME_LENGTH 64
|
#define NAME_LENGTH 64
|
||||||
|
#define DEFAULT_LOG_LEVEL LOG_INFO
|
||||||
|
|
||||||
#define BBF_CONFIG_DAEMON_NAME "bbf_configd"
|
#define BBF_CONFIG_DAEMON_NAME "bbf_configd"
|
||||||
#define CONFIG_CONFDIR "/etc/config/"
|
#define CONFIG_CONFDIR "/etc/config/"
|
||||||
|
|
@ -855,7 +856,7 @@ static void usage(char *prog)
|
||||||
fprintf(stderr, "Usage: %s [options]\n", prog);
|
fprintf(stderr, "Usage: %s [options]\n", prog);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "options:\n");
|
fprintf(stderr, "options:\n");
|
||||||
fprintf(stderr, " -d Use multiple time to get more verbose debug logs (Debug: -dddd)\n");
|
fprintf(stderr, " -l <0-4> Set the loglevel\n");
|
||||||
fprintf(stderr, " -h Displays this help\n");
|
fprintf(stderr, " -h Displays this help\n");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
@ -873,12 +874,17 @@ int main(int argc, char **argv)
|
||||||
.cb = receive_notify_event,
|
.cb = receive_notify_event,
|
||||||
};
|
};
|
||||||
struct ubus_context *uctx;
|
struct ubus_context *uctx;
|
||||||
int ch, log_level = 0;
|
int ch, log_level = DEFAULT_LOG_LEVEL;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "hd")) != -1) {
|
while ((ch = getopt(argc, argv, "hl:")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'd':
|
case 'l':
|
||||||
log_level += 1;
|
if (optarg) {
|
||||||
|
log_level = (int)strtod(optarg, NULL);
|
||||||
|
if (log_level < 0 || log_level > 7) {
|
||||||
|
log_level = DEFAULT_LOG_LEVEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue