su_log.c File Reference


Detailed Description

Implementation of generic logging interface.

Author:
Pekka Pessi <Pekka.Pessi@nokia-email.address.hidden>
Date:
Created: Fri Feb 23 17:30:13 2001 ppessi

#include "config.h"
#include <sofia-sip/su_log.h>
#include <sofia-sip/su_errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <assert.h>
#include <pthread.h>

Include dependency graph for su_log.c:


Functions

void su_perror2 (const char *s, int errcode)
 Log the su error message.
void su_perror (const char *s)
 Log the latest su error message.
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_init (su_log_t *log)
 Initialize a log.
void su_log_redirect (su_log_t *log, su_logger_f *logger, void *logarg)
 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.

Function Documentation

void su_llog ( su_log_t log,
unsigned  level,
char const *  fmt,
  ... 
)

Log a message with level.

Note:
This function is used mainly by SU_DEBUG_n() macros.

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.


Sofia-SIP 1.12.6 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.