lwsl_visible
authorAndy Green <andy@warmcat.com>
Thu, 9 Feb 2017 01:11:17 +0000 (09:11 +0800)
committerAndy Green <andy@warmcat.com>
Thu, 9 Feb 2017 01:11:17 +0000 (09:11 +0800)
lib/libwebsockets.c
lib/libwebsockets.h

index c1cea6f..770cb24 100755 (executable)
@@ -1244,6 +1244,11 @@ LWS_VISIBLE void lws_set_log_level(int level,
                lwsl_emit = func;
 }
 
+LWS_VISIBLE int lwsl_visible(int level)
+{
+       return log_level & level;
+}
+
 LWS_VISIBLE int
 lws_is_ssl(struct lws *wsi)
 {
index 1aea763..8af784c 100644 (file)
@@ -385,6 +385,18 @@ lws_set_log_level(int level,
 LWS_VISIBLE LWS_EXTERN void
 lwsl_emit_syslog(int level, const char *line);
 
+/**
+ * lwsl_visible() - returns true if the log level should be printed
+ *
+ * \param level: one of LLL_ log level indexes
+ *
+ * This is useful if you have to do work to generate the log content, you
+ * can skip the work if the log level used to print it is not actually
+ * enabled at runtime.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lwsl_visible(int level);
+
 ///@}