improve log (show debug only if verbose active)
This commit is contained in:
parent
ed8e91f54b
commit
25d424b716
|
@ -9,8 +9,6 @@ PKG_LICENSE:=APGL
|
|||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
#TARGET_CFLAGS += -DDEBUG
|
||||
|
||||
define Package/wifictld/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
|
@ -23,6 +21,7 @@ define Package/wifictld
|
|||
$(call Package/wifictld/Default)
|
||||
TITLE+= (full)
|
||||
VARIANT:=full
|
||||
TARGET_CFLAGS += -DDEBUG -ggdb3
|
||||
endef
|
||||
|
||||
define Package/wifictld-mini
|
||||
|
|
|
@ -6,6 +6,8 @@ int verbose = 0;
|
|||
|
||||
#ifdef DEBUG
|
||||
void log_debug(const char *format, ...) {
|
||||
if (!verbose)
|
||||
return;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
|
|
|
@ -17,7 +17,7 @@ int main(int argc, char *argv[])
|
|||
log_info("start wifictld (full)\n");
|
||||
#endif
|
||||
|
||||
int c;
|
||||
int c = 0;
|
||||
while ((c = getopt(argc, argv, "v")) != -1) {
|
||||
switch (c) {
|
||||
case 'v':
|
||||
|
@ -37,6 +37,7 @@ int main(int argc, char *argv[])
|
|||
ret = wifi_clients_init();
|
||||
if (ret)
|
||||
{
|
||||
log_error("exit with error on client init\n");
|
||||
return ret;
|
||||
}
|
||||
// bind to loop
|
||||
|
@ -44,6 +45,7 @@ int main(int argc, char *argv[])
|
|||
if (ret)
|
||||
{
|
||||
wifi_clients_close();
|
||||
log_error("exit with error on ubus init\n");
|
||||
return ret;
|
||||
}
|
||||
uloop_run();
|
||||
|
@ -53,5 +55,7 @@ int main(int argc, char *argv[])
|
|||
wifictld_ubus_close();
|
||||
wifi_clients_close();
|
||||
|
||||
log_info("safe exit\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue