Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00034 #ifndef SU_LOG_T
00035
00036 #define SU_LOG_T
00037
00038 typedef struct su_log_s su_log_t;
00039 #endif
00040
00041 #ifndef SU_LOG_H_NEED_SU_LOG_T
00042
00043 #ifndef SU_LOG_H
00044
00045 #define SU_LOG_H
00046
00047 #include <stdarg.h>
00048
00049 #ifndef SU_CONFIG_H
00050 #include <sofia-sip/su_config.h>
00051 #endif
00052
00053 SOFIA_BEGIN_DECLS
00054
00056 typedef void (su_logger_f)(void *stream, char const *fmt, va_list ap);
00057
00059 struct su_log_s {
00060 int log_size;
00061 char const *log_name;
00062 char const *log_env;
00063 unsigned log_default;
00064 unsigned log_level;
00065 int log_init;
00066
00067 su_logger_f *log_logger;
00068 void *log_stream;
00069 };
00070
00071 enum { SU_LOG_MAX = 9 };
00072
00074 #define SU_LOG_INIT(name, env, level) \
00075 { sizeof(su_log_t), name, env, level, SU_LOG_MAX, 0, NULL, NULL, }
00076
00077 SOFIAPUBFUN void su_log(char const *fmt, ...)
00078 __attribute__ ((__format__ (printf, 1, 2)));
00079
00080 SOFIAPUBFUN void su_llog(su_log_t *log, unsigned level, char const *fmt, ...)
00081 __attribute__ ((__format__ (printf, 3, 4)));
00082 SOFIAPUBFUN void su_vllog(su_log_t *log, unsigned level,
00083 char const *fmt, va_list ap);
00084 SOFIAPUBFUN void su_log_redirect(su_log_t *log, su_logger_f *f, void *stream);
00085 SOFIAPUBFUN void su_log_set_level(su_log_t *log, unsigned level);
00086 SOFIAPUBFUN void su_log_soft_set_level(su_log_t *log, unsigned level);
00087 SOFIAPUBFUN void su_log_init(su_log_t *log);
00088
00089 SOFIAPUBVAR su_log_t su_log_default[];
00090 SOFIAPUBVAR su_log_t su_log_global[];
00091
00093 SOFIAPUBFUN void su_perror(char const *s);
00094
00096 SOFIAPUBFUN void su_perror2(char const *s, int errcode);
00097
00098 SOFIA_END_DECLS
00099
00100 #endif
00101
00102 #endif