]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/log.h
Merge pull request #257 from opensourcerouting/nhrpd
[mirror_frr.git] / lib / log.h
index 4fcd44a7133e366d118f374882a2023ff5d143ed..00c996c5be27f24aecf5f1ea3c5fff1d1d497631 100644 (file)
--- a/lib/log.h
+++ b/lib/log.h
@@ -24,6 +24,7 @@
 #define _ZEBRA_LOG_H
 
 #include <syslog.h>
+#include <stdio.h>
 
 /* Here is some guidance on logging levels to use:
  *
  * please use LOG_ERR instead.
  */
 
+/*
+ * This must be kept in the same order as
+ * zlog_proto_names[]
+ */
 typedef enum 
 {
   ZLOG_NONE,
@@ -50,10 +55,13 @@ typedef enum
   ZLOG_BGP,
   ZLOG_OSPF,
   ZLOG_RIPNG,
-  ZLOG_BABEL,
   ZLOG_OSPF6,
+  ZLOG_LDP,
   ZLOG_ISIS,
-  ZLOG_MASC
+  ZLOG_PIM,
+  ZLOG_NHRP,
+  ZLOG_RFP,
+  ZLOG_WATCHFRR,
 } zlog_proto_t;
 
 /* If maxlvl is set to ZLOG_DISABLED, then no messages will be sent
@@ -115,12 +123,17 @@ extern void zlog (struct zlog *zl, int priority, const char *format, ...)
   PRINTF_ATTRIBUTE(3, 4);
 
 /* Handy zlog functions. */
+extern void vzlog (struct zlog *zl, int priority, const char *format, va_list args);
 extern void zlog_err (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
 extern void zlog_warn (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
 extern void zlog_info (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
 extern void zlog_notice (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
 extern void zlog_debug (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
 
+extern void vzlog (struct zlog *, int , const char *, va_list );
+
+extern void zlog_thread_info (int log_level);
+
 /* Set logging level for the given destination.  If the log_level
    argument is ZLOG_DISABLED, then the destination is disabled.
    This function should not be used for file logging (use zlog_set_file
@@ -172,22 +185,28 @@ extern void zlog_backtrace_sigsafe(int priority, void *program_counter);
    It caches the most recent localtime result and can therefore
    avoid multiple calls within the same second.  If buflen is too small,
    *buf will be set to '\0', and 0 will be returned. */
+#define QUAGGA_TIMESTAMP_LEN 40
 extern size_t quagga_timestamp(int timestamp_precision /* # subsecond digits */,
                               char *buf, size_t buflen);
 
-extern void zlog_hexdump(void *mem, unsigned int len);
+extern void zlog_hexdump(const void *mem, unsigned int len);
+extern const char *zlog_sanitize(char *buf, size_t bufsz, const void *in, size_t inlen);
+
+
+extern int 
+vzlog_test (struct zlog *zl, int priority);
 
 /* structure useful for avoiding repeated rendering of the same timestamp */
 struct timestamp_control {
    size_t len;         /* length of rendered timestamp */
    int precision;      /* configuration parameter */
    int already_rendered; /* should be initialized to 0 */
-   char buf[40];       /* will contain the rendered timestamp */
+   char buf[QUAGGA_TIMESTAMP_LEN];     /* will contain the rendered timestamp */
 };
 
-/* Defines for use in command construction: */
+#define LOG_DEFAULT_FILENAME "/var/log/quagga/Quagga.log"
 
-#define LOG_LEVELS "(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)"
+/* Defines for use in command construction: */
 
 #define LOG_LEVEL_DESC \
   "System is unusable\n" \
@@ -199,8 +218,6 @@ struct timestamp_control {
   "Informational messages\n" \
   "Debugging messages\n"
 
-#define LOG_FACILITIES "(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)"
-
 #define LOG_FACILITY_DESC \
        "Kernel\n" \
        "User process\n" \