LOGGING: Pass the log level down to the log target output function
[osmocom-bb.git] / include / osmocore / logging.h
index 93f18a0..5b780a3 100644 (file)
@@ -19,9 +19,7 @@
 #define DEBUGPC(ss, fmt, args...)
 #endif
 
-#define static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
 
-char *hexdump(const unsigned char *buf, int len);
 void logp(unsigned int subsys, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
 
 /* new logging interface */
@@ -85,7 +83,8 @@ struct log_target {
        union {
                struct {
                        FILE *out;
-               } tgt_stdout;
+                       const char *fname;
+               } tgt_file;
 
                struct {
                        int priority;
@@ -96,7 +95,8 @@ struct log_target {
                } tgt_vty;
        };
 
-        void (*output) (struct log_target *target, const char *string);
+        void (*output) (struct log_target *target, unsigned int level,
+                       const char *string);
 };
 
 /* use the above macros */
@@ -117,14 +117,23 @@ void log_set_print_timestamp(struct log_target *target, int);
 void log_set_log_level(struct log_target *target, int log_level);
 void log_parse_category_mask(struct log_target *target, const char* mask);
 int log_parse_level(const char *lvl);
+const char *log_level_str(unsigned int lvl);
 int log_parse_category(const char *category);
 void log_set_category_filter(struct log_target *target, int category,
                               int enable, int level);
 
 /* management of the targets */
 struct log_target *log_target_create(void);
+void log_target_destroy(struct log_target *target);
 struct log_target *log_target_create_stderr(void);
+struct log_target *log_target_create_file(const char *fname);
+int log_target_file_reopen(struct log_target *tgt);
+
 void log_add_target(struct log_target *target);
 void log_del_target(struct log_target *target);
 
+/* Gernerate command argument strings for VTY use */
+const char *log_vty_category_string(struct log_info *info);
+const char *log_vty_level_string(struct log_info *info);
+
 #endif /* _OSMOCORE_LOGGING_H */