| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #ifndef _ZEBRA_LOG_H |
| #define _ZEBRA_LOG_H |
| |
| #include "zassert.h" |
| |
| #include <syslog.h> |
| #include <stdint.h> |
| #include <stdbool.h> |
| #include <stdio.h> |
| #include <stdarg.h> |
| |
| #include "lib/hook.h" |
| #include "lib/zlog.h" |
| #include "lib/zlog_targets.h" |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| extern void zlog_rotate(void); |
| |
| |
| struct message { |
| int key; |
| const char *str; |
| }; |
| |
| |
| #define flog_err(ferr_id, format, ...) \ |
| zlog_err("[EC %u] " format, ferr_id, ##__VA_ARGS__) |
| #define flog_err_sys(ferr_id, format, ...) \ |
| flog_err(ferr_id, format, ##__VA_ARGS__) |
| #define flog_warn(ferr_id, format, ...) \ |
| zlog_warn("[EC %u] " format, ferr_id, ##__VA_ARGS__) |
| #define flog(priority, ferr_id, format, ...) \ |
| zlog(priority, "[EC %u] " format, ferr_id, ##__VA_ARGS__) |
| |
| extern void zlog_thread_info(int log_level); |
| |
| #define ZLOG_FILTERS_MAX 100 |
| #define ZLOG_FILTER_LENGTH_MAX 80 |
| |
| struct zlog_cfg_filterfile { |
| struct zlog_cfg_file parent; |
| }; |
| |
| extern void zlog_filterfile_init(struct zlog_cfg_filterfile *zcf); |
| extern void zlog_filterfile_fini(struct zlog_cfg_filterfile *zcf); |
| |
| |
| extern void zlog_filter_clear(void); |
| extern int zlog_filter_add(const char *filter); |
| extern int zlog_filter_del(const char *filter); |
| extern int zlog_filter_dump(char *buf, size_t max_size); |
| |
| const char *lookup_msg(const struct message *mz, int kz, const char *nf); |
| |
| |
| extern const char *safe_strerror(int errnum); |
| |
| |
| extern void zlog_signal(int signo, const char *action, void *siginfo, |
| void *program_counter); |
| |
| |
| extern void zlog_backtrace(int priority); |
| |
| |
| |
| |
| |
| extern void zlog_backtrace_sigsafe(int priority, void *program_counter); |
| |
| |
| |
| |
| |
| |
| |
| #define QUAGGA_TIMESTAMP_LEN 40 |
| extern size_t quagga_timestamp(int timestamp_precision , |
| char *buf, size_t buflen); |
| |
| extern void zlog_hexdump(const void *mem, size_t len); |
| extern const char *zlog_sanitize(char *buf, size_t bufsz, const void *in, |
| size_t inlen); |
| |
| |
| |
| |
| |
| |
| extern const char *zebra_route_string(unsigned int route_type); |
| |
| extern char zebra_route_char(unsigned int route_type); |
| |
| |
| |
| extern int proto_name2num(const char *s); |
| |
| |
| |
| extern int proto_redistnum(int afi, const char *s); |
| |
| extern const char *zserv_command_string(unsigned int command); |
| |
| |
| |
| struct timestamp_control { |
| size_t len; |
| int precision; |
| int already_rendered; |
| char buf[QUAGGA_TIMESTAMP_LEN]; |
| |
| }; |
| |
| |
| |
| #define LOG_LEVEL_DESC \ |
| "System is unusable\n" \ |
| "Immediate action needed\n" \ |
| "Critical conditions\n" \ |
| "Error conditions\n" \ |
| "Warning conditions\n" \ |
| "Normal but significant conditions\n" \ |
| "Informational messages\n" \ |
| "Debugging messages\n" |
| |
| #define LOG_FACILITY_DESC \ |
| "Kernel\n" \ |
| "User process\n" \ |
| "Mail system\n" \ |
| "System daemons\n" \ |
| "Authorization system\n" \ |
| "Syslog itself\n" \ |
| "Line printer system\n" \ |
| "USENET news\n" \ |
| "Unix-to-Unix copy system\n" \ |
| "Cron/at facility\n" \ |
| "Local use\n" \ |
| "Local use\n" \ |
| "Local use\n" \ |
| "Local use\n" \ |
| "Local use\n" \ |
| "Local use\n" \ |
| "Local use\n" \ |
| "Local use\n" |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| |
| #endif |