Implement syslog.
[bertos.git] / bertos / cfg / log.h
index 1e4fc150bb2f38621d8deec91a44b90429e4ed75..086d4615817f3a920a0070ae31b8dc4c8a49ca9c 100644 (file)
 #define LOG_FMT_TERSE     0
 /** \} */
 
-#if LOG_FORMAT == LOG_FMT_VERBOSE
-       #define LOG_PRINT(str_level, str,...)    kprintf("%s():%d:%s: " str, __func__, __LINE__, str_level, ## __VA_ARGS__)
-#elif LOG_FORMAT == LOG_FMT_TERSE
-       #define LOG_PRINT(str_level, str,...)    kprintf("%s: " str, str_level, ## __VA_ARGS__)
+#include "cfg/cfg_syslog.h"
+
+/* For backward compatibility */
+#ifndef CONFIG_SYSLOG_NET
+       #define CONFIG_SYSLOG_NET 0
+#endif
+
+#if CONFIG_SYSLOG_NET
+       #include <net/syslog.h>
+
+       #if LOG_FORMAT == LOG_FMT_VERBOSE
+               #define LOG_PRINT(str_level, str,...)    syslog_printf("<182>%d-%s():%d:%s: " str, syslog_count(), __func__, __LINE__, str_level, ## __VA_ARGS__)
+       #elif LOG_FORMAT == LOG_FMT_TERSE
+               #define LOG_PRINT(str_level, str,...)    syslog_printf("<182>%d-%s: " str, syslog_count(), str_level, ## __VA_ARGS__)
+       #else
+               #error No LOG_FORMAT defined
+       #endif
+
 #else
-       #error No LOG_FORMAT defined
+       #if LOG_FORMAT == LOG_FMT_VERBOSE
+               #define LOG_PRINT(str_level, str,...)    kprintf("%s():%d:%s: " str, __func__, __LINE__, str_level, ## __VA_ARGS__)
+       #elif LOG_FORMAT == LOG_FMT_TERSE
+               #define LOG_PRINT(str_level, str,...)    kprintf("%s: " str, str_level, ## __VA_ARGS__)
+       #else
+               #error No LOG_FORMAT defined
+       #endif
+
 #endif
 
 #if LOG_LEVEL >= LOG_LVL_ERR