# logger.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: logger.h,v $
    00003                              -------------------
    00004     cvs         : $Id: logger.h,v 1.11 2004/09/09 08:33:09 cstim Exp $
    00005     begin       : Sun Dec 05 2003
    00006     copyright   : (C) 2003 by Martin Preuss
    00007     email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    00025  *                                                                         *
    00026  ***************************************************************************/
    00027
    00028 #ifndef GWEN_LOGGER_H
    00029 #define GWEN_LOGGER_H
    00030
    00031 #ifdef __cplusplus
    00032 extern "C" {
    00033 #endif
    00034
    00035 #define GWEN_LOGDOMAIN "gwenhywfar"
    00036
    00037 #include <gwenhywfar/gwenhywfarapi.h>
    00038
    00039 typedef struct GWEN_LOGGER GWEN_LOGGER;
    00040
    00041 typedef void (*GWEN_LOGGERFUNCTIONLOG)(const char *s);
    00042
    00043 typedef enum {
    00044   GWEN_LoggerTypeConsole,
    00045   GWEN_LoggerTypeFile,
    00046   GWEN_LoggerTypeSyslog,
    00047   GWEN_LoggerTypeFunction,
    00048
    00049   GWEN_LoggerTypeUnknown=9999
    00050 } GWEN_LOGGER_LOGTYPE;
    00051
    00052
    00053 typedef enum {
    00054   GWEN_LoggerFacilityAuth=0,
    00055   GWEN_LoggerFacilityDaemon,
    00056   GWEN_LoggerFacilityMail,
    00057   GWEN_LoggerFacilityNews,
    00058   GWEN_LoggerFacilityUser,
    00059
    00060   GWEN_LoggerFacilityUnknown=9999
    00061 } GWEN_LOGGER_FACILITY;
    00062
    00063
    00064 typedef enum {
    00065   GWEN_LoggerLevelEmergency=0,
    00066   GWEN_LoggerLevelAlert,
    00067   GWEN_LoggerLevelCritical,
    00068   GWEN_LoggerLevelError,
    00069   GWEN_LoggerLevelWarning,
    00070   GWEN_LoggerLevelNotice,
    00071   GWEN_LoggerLevelInfo,
    00072   GWEN_LoggerLevelDebug,
    00073   GWEN_LoggerLevelVerbous,
    00074
    00075   GWEN_LoggerLevelUnknown=9999
    00076 } GWEN_LOGGER_LEVEL;
    00077
    00078
    00079
    00080 GWENHYWFAR_API
    00081 GWEN_LOGGER *GWEN_Logger_new();
    00082
    00083 GWENHYWFAR_API
    00084 void GWEN_Logger_free(GWEN_LOGGER *lg);
    00085
    00086 GWENHYWFAR_API
    00087 void GWEN_Logger_Attach(GWEN_LOGGER *lg);
    00088
    00089
    00095 GWENHYWFAR_API
    00096 void GWEN_Logger_AddLogger(GWEN_LOGGER *oldLogger, GWEN_LOGGER *newLogger);
    00097
    00098
    00104 GWENHYWFAR_API
    00105 void GWEN_Logger_SetDefaultLogger(GWEN_LOGGER *lg)
    00106 #ifdef __GNUC__
    00107        __attribute__((deprecated))
    00108 #endif /* __GNUC__ */
    00109        ;
    00110
    00111
    00116 GWENHYWFAR_API int GWEN_Logger_Exists(const char *logDomain);
    00117
    00118
    00130 GWENHYWFAR_API int GWEN_Logger_Open(const char *logDomain,
    00131                                     const char *ident,
    00132                                     const char *file,
    00133                                     GWEN_LOGGER_LOGTYPE logtype,
    00134                                     GWEN_LOGGER_FACILITY facility);
    00135
    00140 GWENHYWFAR_API void GWEN_Logger_Close(const char *logDomain);
    00141
    00145 GWENHYWFAR_API int GWEN_Logger_IsOpen(const char *logDomain);
    00146
    00147
    00155 GWENHYWFAR_API int GWEN_Logger_Log(const char *logDomain,
    00156                                    GWEN_LOGGER_LEVEL priority, const char *s);
    00157
    00163 GWENHYWFAR_API void GWEN_Logger_Enable(const char *logDomain,
    00164                                        int f);
    00165
    00171 GWENHYWFAR_API int GWEN_Logger_IsEnabled(const char *logDomain);
    00172
    00179 GWENHYWFAR_API void GWEN_Logger_SetLevel(const char *logDomain,
    00180                                          GWEN_LOGGER_LEVEL l);
    00181
    00186 GWENHYWFAR_API int GWEN_Logger_GetLevel(const char *logDomain);
    00187
    00188
    00194 GWENHYWFAR_API void GWEN_Logger_SetIdent(const char *logDomain,
    00195                                          const char *id);
    00196
    00200 void GWEN_Logger_SetFilename(const char *logDomain, const char *name);
    00201
    00202
    00208 GWENHYWFAR_API
    00209   GWEN_LOGGERFUNCTIONLOG GWEN_Logger_SetLogFunction(const char *logDomain,
    00210                                                     GWEN_LOGGERFUNCTIONLOG fn);
    00211
    00215 GWENHYWFAR_API
    00216   GWEN_LOGGER_LEVEL GWEN_Logger_Name2Level(const char *name);
    00217
    00218
    00223 GWENHYWFAR_API
    00224   const char *GWEN_Logger_Level2Name(GWEN_LOGGER_LEVEL level);
    00225
    00226
    00230 GWENHYWFAR_API
    00231   GWEN_LOGGER_LOGTYPE GWEN_Logger_Name2Logtype(const char *name);
    00232
    00236 GWENHYWFAR_API
    00237   const char *GWEN_Logger_Logtype2Name(GWEN_LOGGER_LOGTYPE lt);
    00238
    00239
    00240
    00241 #ifdef __cplusplus
    00242 }
    00243 #endif
    00244
    00245
    00246 #endif /* #ifndef CH_LOGGER_H */
    00247
    00248