su 1.12.11devel
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
su_log.h File Reference

SU logging interface. More...

#include <stdarg.h>
#include <sofia-sip/su_config.h>
Include dependency graph for su_log.h:

Go to the source code of this file.

Data Structures

struct  su_log_s
 Log object. More...
 

Macros

#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.
 

Detailed Description

SU logging interface.

Author
Pekka Pessi Pekka.nosp@m..Pes.nosp@m.si@no.nosp@m.kia..nosp@m.com.
Date
Created: Thu Feb 22 18:09:02 2001 ppessi

Function Documentation

◆ su_llog()

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.

◆ su_log()

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.

◆ su_log_redirect()

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.

◆ su_log_set_level()

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.

◆ su_log_soft_set_level()

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.

◆ su_perror()

void su_perror ( const char *  s)

Log the latest su error message.

Log the latest su error message.

◆ su_perror2()

void su_perror2 ( const char *  s,
int  errcode 
)

Log the su error message.

Log the su error message.

Variable Documentation

◆ su_log_default

su_log_t su_log_default[]
extern

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.

◆ su_log_global

su_log_t su_log_global[]
extern

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.


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