logger.h
Go to the documentation of this file.
/***************************************************************************
begin : Sun Dec 05 2003
copyright : (C) 2003 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* *
* 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., 59 Temple Place, Suite 330, Boston, *
* MA 02111-1307 USA *
* *
***************************************************************************/
#ifndef GWEN_LOGGER_H
#define GWEN_LOGGER_H
#ifdef __cplusplus
extern "C" {
#endif
#define GWEN_LOGDOMAIN "gwenhywfar"
#include <gwenhywfar/gwenhywfarapi.h>
#include <gwenhywfar/buffer.h>
typedef void GWENHYWFAR_CB(*GWEN_LOGGERFUNCTIONLOG)(const char *s);
typedef enum {
GWEN_LoggerType_Console,
GWEN_LoggerType_File,
GWEN_LoggerType_Syslog,
GWEN_LoggerType_Function,
GWEN_LoggerType_Unknown=9999
} GWEN_LOGGER_LOGTYPE;
typedef enum {
GWEN_LoggerFacility_Auth=0,
GWEN_LoggerFacility_Daemon,
GWEN_LoggerFacility_Mail,
GWEN_LoggerFacility_News,
GWEN_LoggerFacility_User,
GWEN_LoggerFacility_Unknown=9999
} GWEN_LOGGER_FACILITY;
typedef enum {
GWEN_LoggerLevel_Emergency=0,
GWEN_LoggerLevel_Alert,
GWEN_LoggerLevel_Critical,
GWEN_LoggerLevel_Error,
GWEN_LoggerLevel_Warning,
GWEN_LoggerLevel_Notice,
GWEN_LoggerLevel_Info,
GWEN_LoggerLevel_Debug,
GWEN_LoggerLevel_Verbous,
GWEN_LoggerLevel_Unknown=9999
} GWEN_LOGGER_LEVEL;
GWENHYWFAR_API int GWEN_Logger_Exists(const char *logDomain);
GWENHYWFAR_API int GWEN_Logger_Open(const char *logDomain,
const char *ident,
const char *file,
GWEN_LOGGER_LOGTYPE logtype,
GWEN_LOGGER_FACILITY facility);
GWENHYWFAR_API void GWEN_Logger_Close(const char *logDomain);
GWENHYWFAR_API int GWEN_Logger_IsOpen(const char *logDomain);
GWENHYWFAR_API void GWEN_Logger_Log(const char *logDomain,
GWEN_LOGGER_LEVEL priority, const char *s);
GWENHYWFAR_API void GWEN_Logger_Enable(const char *logDomain,
int f);
GWENHYWFAR_API int GWEN_Logger_IsEnabled(const char *logDomain);
GWENHYWFAR_API void GWEN_Logger_SetLevel(const char *logDomain,
GWEN_LOGGER_LEVEL l);
GWENHYWFAR_API int GWEN_Logger_GetLevel(const char *logDomain);
GWENHYWFAR_API void GWEN_Logger_SetIdent(const char *logDomain,
const char *id);
void GWEN_Logger_SetFilename(const char *logDomain, const char *name);
GWENHYWFAR_API
GWEN_LOGGERFUNCTIONLOG GWEN_Logger_SetLogFunction(const char *logDomain,
GWEN_LOGGERFUNCTIONLOG fn);
GWENHYWFAR_API
GWEN_LOGGER_LEVEL GWEN_Logger_Name2Level(const char *name);
GWENHYWFAR_API
const char *GWEN_Logger_Level2Name(GWEN_LOGGER_LEVEL level);
GWENHYWFAR_API
GWEN_LOGGER_LOGTYPE GWEN_Logger_Name2Logtype(const char *name);
GWENHYWFAR_API
const char *GWEN_Logger_Logtype2Name(GWEN_LOGGER_LOGTYPE lt);
GWENHYWFAR_API
int GWEN_Logger_CreateLogMessage(const char *logDomain,
GWEN_LOGGER_LEVEL priority, const char *s,
GWEN_BUFFER *mbuf);
#ifdef __cplusplus
}
#endif
#endif /* #ifndef CH_LOGGER_H */
buffer.h
GWEN_BUFFER
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
gwenhywfarapi.h
GWENHYWFAR_API
#define GWENHYWFAR_API
Definition gwenhywfarapi.h:67
GWENHYWFAR_CB
#define GWENHYWFAR_CB
Definition gwenhywfarapi.h:89
GWEN_Logger_GetLevel
GWENHYWFAR_API int GWEN_Logger_GetLevel(const char *logDomain)
GWEN_LOGGER_LOGTYPE
GWEN_LOGGER_LOGTYPE
Definition logger.h:40
GWEN_LoggerType_File
@ GWEN_LoggerType_File
Definition logger.h:42
GWEN_LoggerType_Console
@ GWEN_LoggerType_Console
Definition logger.h:41
GWEN_LoggerType_Syslog
@ GWEN_LoggerType_Syslog
Definition logger.h:43
GWEN_LoggerType_Unknown
@ GWEN_LoggerType_Unknown
Definition logger.h:46
GWEN_LoggerType_Function
@ GWEN_LoggerType_Function
Definition logger.h:44
GWEN_Logger_SetLevel
GWENHYWFAR_API void GWEN_Logger_SetLevel(const char *logDomain, GWEN_LOGGER_LEVEL l)
GWEN_Logger_IsOpen
GWENHYWFAR_API int GWEN_Logger_IsOpen(const char *logDomain)
GWEN_LOGGER_FACILITY
GWEN_LOGGER_FACILITY
Definition logger.h:50
GWEN_LoggerFacility_Mail
@ GWEN_LoggerFacility_Mail
Definition logger.h:53
GWEN_LoggerFacility_Unknown
@ GWEN_LoggerFacility_Unknown
Definition logger.h:57
GWEN_LoggerFacility_News
@ GWEN_LoggerFacility_News
Definition logger.h:54
GWEN_LoggerFacility_Daemon
@ GWEN_LoggerFacility_Daemon
Definition logger.h:52
GWEN_LoggerFacility_Auth
@ GWEN_LoggerFacility_Auth
Definition logger.h:51
GWEN_LoggerFacility_User
@ GWEN_LoggerFacility_User
Definition logger.h:55
GWEN_Logger_CreateLogMessage
GWENHYWFAR_API int GWEN_Logger_CreateLogMessage(const char *logDomain, GWEN_LOGGER_LEVEL priority, const char *s, GWEN_BUFFER *mbuf)
GWEN_Logger_Log
GWENHYWFAR_API void GWEN_Logger_Log(const char *logDomain, GWEN_LOGGER_LEVEL priority, const char *s)
GWEN_Logger_IsEnabled
GWENHYWFAR_API int GWEN_Logger_IsEnabled(const char *logDomain)
GWEN_Logger_Close
GWENHYWFAR_API void GWEN_Logger_Close(const char *logDomain)
GWEN_Logger_SetFilename
void GWEN_Logger_SetFilename(const char *logDomain, const char *name)
GWEN_Logger_Name2Level
GWENHYWFAR_API GWEN_LOGGER_LEVEL GWEN_Logger_Name2Level(const char *name)
GWEN_Logger_Logtype2Name
GWENHYWFAR_API const char * GWEN_Logger_Logtype2Name(GWEN_LOGGER_LOGTYPE lt)
GWEN_Logger_Level2Name
GWENHYWFAR_API const char * GWEN_Logger_Level2Name(GWEN_LOGGER_LEVEL level)
GWEN_Logger_Exists
GWENHYWFAR_API int GWEN_Logger_Exists(const char *logDomain)
GWEN_Logger_SetIdent
GWENHYWFAR_API void GWEN_Logger_SetIdent(const char *logDomain, const char *id)
GWEN_LOGGER_LEVEL
GWEN_LOGGER_LEVEL
Definition logger.h:61
GWEN_LoggerLevel_Alert
@ GWEN_LoggerLevel_Alert
Definition logger.h:63
GWEN_LoggerLevel_Emergency
@ GWEN_LoggerLevel_Emergency
Definition logger.h:62
GWEN_LoggerLevel_Unknown
@ GWEN_LoggerLevel_Unknown
Definition logger.h:72
GWEN_LoggerLevel_Warning
@ GWEN_LoggerLevel_Warning
Definition logger.h:66
GWEN_LoggerLevel_Notice
@ GWEN_LoggerLevel_Notice
Definition logger.h:67
GWEN_LoggerLevel_Debug
@ GWEN_LoggerLevel_Debug
Definition logger.h:69
GWEN_LoggerLevel_Critical
@ GWEN_LoggerLevel_Critical
Definition logger.h:64
GWEN_LoggerLevel_Verbous
@ GWEN_LoggerLevel_Verbous
Definition logger.h:70
GWEN_LoggerLevel_Info
@ GWEN_LoggerLevel_Info
Definition logger.h:68
GWEN_LoggerLevel_Error
@ GWEN_LoggerLevel_Error
Definition logger.h:65
GWEN_Logger_Open
GWENHYWFAR_API int GWEN_Logger_Open(const char *logDomain, const char *ident, const char *file, GWEN_LOGGER_LOGTYPE logtype, GWEN_LOGGER_FACILITY facility)
GWEN_LOGGERFUNCTIONLOG
void GWENHYWFAR_CB(* GWEN_LOGGERFUNCTIONLOG)(const char *s)
Definition logger.h:38
GWEN_Logger_Name2Logtype
GWENHYWFAR_API GWEN_LOGGER_LOGTYPE GWEN_Logger_Name2Logtype(const char *name)
GWEN_Logger_Enable
GWENHYWFAR_API void GWEN_Logger_Enable(const char *logDomain, int f)
GWEN_Logger_SetLogFunction
GWENHYWFAR_API GWEN_LOGGERFUNCTIONLOG GWEN_Logger_SetLogFunction(const char *logDomain, GWEN_LOGGERFUNCTIONLOG fn)