diff --git a/README-test-server b/README-test-server index fa61c108..cd0e7899 100644 --- a/README-test-server +++ b/README-test-server @@ -84,7 +84,7 @@ There are several other possible configure options --without-daemonize Don't build daemonize.c / lws_daemonize ---disable-debug Remove all debug logging below lwsl_warn in severity +--disable-debug Remove all debug logging below lwsl_notice in severity from the code -- it's not just defeated from logging but removed from compilation @@ -399,11 +399,11 @@ libwebsockets-test-client someserver.com debug logging ------------- -By default logging of severity "warn" or "err" is enabled to stderr. +By default logging of severity "notice", "warn" or "err" is enabled to stderr. Again by default other logging is comiled in but disabled from printing. -If you want to eliminate the debug logging below warn in severity, use the +If you want to eliminate the debug logging below notice in severity, use the --disable-debug configure option to have it removed from the code by the preprocesser. @@ -414,12 +414,13 @@ available are (OR together the numbers to select multiple) 1 ERR 2 WARN - 4 INFO - 8 DEBUG - 16 PARSER - 32 HEADER - 64 EXTENSION - 128 CLIENT + 4 NOTICE + 8 INFO + 16 DEBUG + 32 PARSER + 64 HEADER + 128 EXTENSION + 256 CLIENT Also using lws_set_log_level api you may provide a custom callback to actually emit the log string. By default, this points to an internal emit function diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index f4d33199..ed0db66f 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -47,12 +47,13 @@ int openssl_websocket_private_data_index; #endif #endif -static int log_level = LLL_ERR | LLL_WARN; +static int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE; static void lwsl_emit_stderr(const char *line); static void (*lwsl_emit)(const char *line) = lwsl_emit_stderr; static const char *log_level_names[] = { "ERR", "WARN", + "NOTICE", "INFO", "DEBUG", "PARSER", diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index 0bc5050f..c5654918 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -69,14 +69,15 @@ typedef int ssize_t; enum lws_log_levels { LLL_ERR = 1 << 0, LLL_WARN = 1 << 1, - LLL_INFO = 1 << 2, - LLL_DEBUG = 1 << 3, - LLL_PARSER = 1 << 4, - LLL_HEADER = 1 << 5, - LLL_EXT = 1 << 6, - LLL_CLIENT = 1 << 7, + LLL_NOTICE = 1 << 2, + LLL_INFO = 1 << 3, + LLL_DEBUG = 1 << 4, + LLL_PARSER = 1 << 5, + LLL_HEADER = 1 << 6, + LLL_EXT = 1 << 7, + LLL_CLIENT = 1 << 8, - LLL_COUNT = 8 /* set to count of valid flags */ + LLL_COUNT = 9 /* set to count of valid flags */ }; enum libwebsocket_context_options { diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index a3047f77..d70bd33b 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -83,7 +83,8 @@ extern void _lws_log(int filter, const char *format, ...); -/* warn and log are always compiled in */ +/* notice, warn and log are always compiled in */ +#define lwsl_notice(...) _lws_log(LLL_NOTICE, __VA_ARGS__) #define lwsl_warn(...) _lws_log(LLL_WARN, __VA_ARGS__) #define lwsl_err(...) _lws_log(LLL_ERR, __VA_ARGS__)