SU logging interface. More...
#include <stdarg.h>
#include <sofia-sip/su_config.h>
Go to the source code of this file.
Data Structures | |
struct | su_log_s |
Log object. More... | |
Defines | |
#define | SU_LOG_T |
Defined when the type su_log_t has been defined. | |
#define | SU_LOG_H |
Defined when <sofia-sip/su_log.h> has been included. | |
#define | SU_LOG_INIT(name, env, level) |
Initialize a su_log_t structure. | |
Typedefs | |
typedef struct su_log_s | su_log_t |
Type of log structure. | |
typedef void( | su_logger_f )(void *stream, char const *fmt, va_list ap) |
Prototype for logging function. | |
Functions | |
void | su_log (char const *fmt,...))) |
Log a message to default log. | |
void | su_llog (su_log_t *log, unsigned level, char const *fmt,...))) |
Log a message with level. | |
void | su_vllog (su_log_t *log, unsigned level, char const *fmt, va_list ap) |
Log a message with level (stdarg version). | |
void | su_log_redirect (su_log_t *log, su_logger_f *f, void *stream) |
Redirect a log. | |
void | su_log_set_level (su_log_t *log, unsigned level) |
Set log level. | |
void | su_log_soft_set_level (su_log_t *log, unsigned level) |
Set log level. | |
void | su_log_init (su_log_t *log) |
Initialize a log. | |
void | su_perror (char const *s) |
Log the latest su error message. | |
void | su_perror2 (char const *s, int errcode) |
Log the su error message. | |
Variables | |
su_log_t | su_log_default [] |
Default debug log. | |
su_log_t | su_log_global [] |
Debug log for su module. |
SU logging interface.
#define SU_LOG_H |
Defined when <sofia-sip/su_log.h> has been included.
#define SU_LOG_T |
Defined when the type su_log_t has been defined.
void su_llog | ( | su_log_t * | log, | |
unsigned | level, | |||
char const * | fmt, | |||
... | ||||
) |
Log a message with level.
void su_log | ( | char const * | fmt, | |
... | ||||
) |
Log a message to default log.
This function is a replacement for printf().
Messages are always logged to the default log.
void su_log_redirect | ( | su_log_t * | log, | |
su_logger_f * | logger, | |||
void * | logarg | |||
) |
Redirect a log.
The function su_log_redirect() redirects the su_log() output to logger function. The logger function has following prototype:
void logger(void *logarg, char const *format, va_list ap);
If logger is NULL, the default logger will be used. If log is NULL, the default logger is changed.
void su_log_set_level | ( | su_log_t * | log, | |
unsigned | level | |||
) |
Set log level.
The function su_log_set_level() sets the logging level. The log events have certain level (0..9); if logging level is lower than the level of the event, the log message is ignored.
If log is NULL, the default log level is changed.
void su_log_soft_set_level | ( | su_log_t * | log, | |
unsigned | level | |||
) |
Set log level.
The function su_log_soft_set_level() sets the logging level if it is not already set, or the environment variable controlling the log level is not set.
The log events have certain level (0..9); if logging level is lower than the level of the event, the log message is ignored.
If log is NULL, the default log level is changed.
void su_perror2 | ( | const char * | s, | |
int | errcode | |||
) |
Log the su error message.
void su_vllog | ( | su_log_t * | log, | |
unsigned | level, | |||
char const * | fmt, | |||
va_list | ap | |||
) |
Log a message with level (stdarg version).
Default debug log.
If a source module does not define a log object, the output from su_log() function or SU_DEBUG_X() macros use this log object. Also, if a log function references log object with NULL pointer, the su_log_default object is used.
If output from another log object is not redirected with su_log_redirect(), the output can be redirected via this log object.
If the logging level of a log object is not set with su_log_set_level(), or the environment variable directing its level is not set, the log level from the su_log_default object is used.
The level of su_log_default is set using SOFIA_DEBUG environment variable.
Debug log for su module.
The su_log_global is the log object used by su module. The level of su_log_global is set using SU_DEBUG environment variable.