summaryrefslogtreecommitdiff
path: root/include/dlt/dlt_common.h
diff options
context:
space:
mode:
authorMartin Willers <M.Willers@gmx.net>2021-03-16 00:53:55 +0100
committerGitHub <noreply@github.com>2021-03-16 08:53:55 +0900
commitfff5caa73977e8a6f2537a5a459fb13af5397385 (patch)
tree64a02e9318c900450c2220ac61c23e564d741c3d /include/dlt/dlt_common.h
parent87eb30aa30005f8fd6a449d5bcc5d0e60c563c0b (diff)
downloadDLT-daemon-fff5caa73977e8a6f2537a5a459fb13af5397385.tar.gz
Add verbose mode attribute handling (#292)
dlt_user_log_write_*_attr() enables to writing these types, but also support adding "attributes" for them, i.e. a "name" and a "unit". Signed-off-by: Martin Willers <M.Willers@gmx.net>
Diffstat (limited to 'include/dlt/dlt_common.h')
-rw-r--r--include/dlt/dlt_common.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h
index 3e7100e..049b6ee 100644
--- a/include/dlt/dlt_common.h
+++ b/include/dlt/dlt_common.h
@@ -75,6 +75,7 @@
# include <netinet/in.h>
# include <stdio.h>
+# include <stdbool.h>
# ifdef __linux__
# include <linux/limits.h>
# include <sys/socket.h>
@@ -89,8 +90,10 @@
# if defined(__GNUC__)
# define PURE_FUNCTION __attribute__((pure))
+# define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, a, b)))
# else
# define PURE_FUNCTION /* nothing */
+# define PRINTF_FORMAT(a,b) /* nothing */
# endif
# if !defined (__WIN32__) && !defined(_MSC_VER)
@@ -1170,6 +1173,13 @@ void dlt_log_set_fifo_basedir(const char *pipe_dir);
* @param level the level
*/
void dlt_log_set_level(int level);
+
+/**
+ * Set whether to print "name" and "unit" attributes in console output
+ * @param state true = with attributes, false = without attributes
+ */
+void dlt_print_with_attributes(bool state);
+
/**
* Initialize (external) logging facility
* @param mode positive, 0 = log to stdout, 1 = log to syslog, 2 = log to file, 3 = log to stderr
@@ -1180,7 +1190,7 @@ void dlt_log_init(int mode);
* @param format format string for message
* @return negative value if there was an error or the total number of characters written is returned on success
*/
-int dlt_user_printf(const char *format, ...);
+int dlt_user_printf(const char *format, ...) PRINTF_FORMAT(1,2);
/**
* Log ASCII string with null-termination to (external) logging facility
* @param prio priority (see syslog() call)