Loading...
Searching...
No Matches
su_log.h
Go to the documentation of this file.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SU_LOG_T
#define SU_LOG_T
typedef struct su_log_s su_log_t;
#endif
#ifndef SU_LOG_H_NEED_SU_LOG_T
#ifndef SU_LOG_H
#define SU_LOG_H
#include <stdarg.h>
#ifndef SU_CONFIG_H
#include <sofia-sip/su_config.h>
#endif
SOFIA_BEGIN_DECLS
typedef void (su_logger_f)(void *stream, char const *fmt, va_list ap);
struct su_log_s {
int log_size;
char const *log_name;
char const *log_env;
unsigned log_default;
unsigned log_level;
int log_init;
su_logger_f *log_logger;
void *log_stream;
};
enum { SU_LOG_MAX = 9 };
#define SU_LOG_INIT(name, env, level) \
{ sizeof(su_log_t), name, env, level, SU_LOG_MAX, 0, NULL, NULL, }
SOFIAPUBFUN void su_log(char const *fmt, ...)
__attribute__ ((__format__ (printf, 1, 2)));
SOFIAPUBFUN void su_llog(su_log_t *log, unsigned level, char const *fmt, ...)
__attribute__ ((__format__ (printf, 3, 4)));
SOFIAPUBFUN void su_vllog(su_log_t *log, unsigned level,
char const *fmt, va_list ap);
SOFIAPUBFUN void su_log_redirect(su_log_t *log, su_logger_f *f, void *stream);
SOFIAPUBFUN void su_log_set_level(su_log_t *log, unsigned level);
SOFIAPUBFUN void su_log_soft_set_level(su_log_t *log, unsigned level);
SOFIAPUBFUN void su_log_init(su_log_t *log);
SOFIAPUBVAR su_log_t su_log_default[];
SOFIAPUBVAR su_log_t su_log_global[];
SOFIAPUBFUN void su_perror(char const *s);
SOFIAPUBFUN void su_perror2(char const *s, int errcode);
SOFIA_END_DECLS
#endif
#endif /* !defined(SU_LOG_H_NEED_SU_LOG_T) */
su_log_s
Log object.
Definition su_log.h:59
su_config.h
su library configuration
SOFIAPUBFUN
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition su_config.h:66
SOFIAPUBVAR
#define SOFIAPUBVAR
SOFIAPUBVAR declares an exported variable.
Definition su_config.h:68
su_log_redirect
void su_log_redirect(su_log_t *log, su_logger_f *f, void *stream)
Redirect a log.
Definition su_log.c:195
su_log
void su_log(char const *fmt,...)))
Log a message to default log.
Definition su_log.c:90
su_log_global
su_log_t su_log_global[]
Debug log for su module.
Definition su_global_log.c:65
su_log_t
struct su_log_s su_log_t
Type of log structure.
Definition su_log.h:38
su_perror
void su_perror(char const *s)
Log the latest su error message.
Definition su_log.c:79
su_llog
void su_llog(su_log_t *log, unsigned level, char const *fmt,...)))
Log a message with level.
Definition su_log.c:103
su_logger_f
void su_logger_f(void *stream, char const *fmt, va_list ap)
Prototype for logging function.
Definition su_log.h:56
su_log_set_level
void su_log_set_level(su_log_t *log, unsigned level)
Set log level.
Definition su_log.c:212
su_log_init
void su_log_init(su_log_t *log)
Initialize a log.
Definition su_log.c:144
su_vllog
void su_vllog(su_log_t *log, unsigned level, char const *fmt, va_list ap)
Log a message with level (stdarg version).
Definition su_log.c:113
su_log_default
su_log_t su_log_default[]
Default debug log.
Definition su_default_log.c:83
su_perror2
void su_perror2(char const *s, int errcode)
Log the su error message.
Definition su_log.c:73
su_log_soft_set_level
void su_log_soft_set_level(su_log_t *log, unsigned level)
Set log level.
Definition su_log.c:239

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