summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2018-01-20 17:31:20 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2018-01-20 17:31:20 +0000
commit0dd48e83fbc246a881609b4c18ce10001ba1cc1a (patch)
tree7494cc81744799ab88f1503ac5ff044be2fcf4a5 /src
parente220b0fc2ede1dcbbe7e6e62c256e2ec297f26a3 (diff)
downloadlibcss-0dd48e83fbc246a881609b4c18ce10001ba1cc1a.tar.gz
libcss-0dd48e83fbc246a881609b4c18ce10001ba1cc1a.tar.bz2
Add support for logging via libnslog.
Release builds minumum compiled level is warning. Debug builds minimum compiled level is debug.
Diffstat (limited to 'src')
-rw-r--r--src/utils/Makefile2
-rw-r--r--src/utils/log.c17
-rw-r--r--src/utils/log.h19
3 files changed, 37 insertions, 1 deletions
diff --git a/src/utils/Makefile b/src/utils/Makefile
index c317eea..f3fa8fb 100644
--- a/src/utils/Makefile
+++ b/src/utils/Makefile
@@ -1,4 +1,4 @@
# Sources
-DIR_SOURCES := errors.c utils.c
+DIR_SOURCES := errors.c log.c utils.c
include $(NSBUILD)/Makefile.subdir
diff --git a/src/utils/log.c b/src/utils/log.c
new file mode 100644
index 0000000..f16c553
--- /dev/null
+++ b/src/utils/log.c
@@ -0,0 +1,17 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2018 Michael Drake <tlsa@netsurf-browser.org>
+ */
+
+#include <stddef.h>
+
+#include "utils/log.h"
+
+NSLOG_DEFINE_CATEGORY(libcss, "LibCSS");
+
+NSLOG_DEFINE_SUBCATEGORY(libcss, libcss_selection, "Selection");
+
+NSLOG_DEFINE_SUBCATEGORY(libcss_selection, libcss_selection_style_sharing,
+ "Computed style sharing");
diff --git a/src/utils/log.h b/src/utils/log.h
new file mode 100644
index 0000000..6579d92
--- /dev/null
+++ b/src/utils/log.h
@@ -0,0 +1,19 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2018 Michael Drake <tlsa@netsurf-browser.org>
+ */
+
+#ifndef css_utils_log_h_
+#define css_utils_log_h_
+
+#include <nslog/nslog.h>
+
+/** Logging sub-category for Selection. */
+NSLOG_DECLARE_CATEGORY(libcss_selection);
+
+/** Logging sub-category for Selection style sharing. */
+NSLOG_DECLARE_CATEGORY(libcss_selection_style_sharing);
+
+#endif