logger.h File Reference
#include <gwenhywfar/gwenhywfarapi.h>
Go to the source code of this file.
|
Defines |
| #define | GWEN_LOGDOMAIN "gwenhywfar" |
Typedefs |
| typedef void GWENHYWFAR_CB(* | GWEN_LOGGERFUNCTIONLOG )(const char *s) |
Enumerations |
| enum | GWEN_LOGGER_FACILITY {
GWEN_LoggerFacility_Auth = 0,
GWEN_LoggerFacility_Daemon,
GWEN_LoggerFacility_Mail,
GWEN_LoggerFacility_News,
GWEN_LoggerFacility_User,
GWEN_LoggerFacility_Unknown = 9999
} |
| enum | GWEN_LOGGER_LEVEL {
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
} |
| enum | GWEN_LOGGER_LOGTYPE {
GWEN_LoggerType_Console,
GWEN_LoggerType_File,
GWEN_LoggerType_Syslog,
GWEN_LoggerType_Function,
GWEN_LoggerType_Unknown = 9999
} |
Functions |
| GWENHYWFAR_API void | GWEN_Logger_Close (const char *logDomain) |
| GWENHYWFAR_API void | GWEN_Logger_Enable (const char *logDomain, int f) |
| GWENHYWFAR_API int | GWEN_Logger_Exists (const char *logDomain) |
| GWENHYWFAR_API int | GWEN_Logger_GetLevel (const char *logDomain) |
| GWENHYWFAR_API int | GWEN_Logger_IsEnabled (const char *logDomain) |
| GWENHYWFAR_API int | GWEN_Logger_IsOpen (const char *logDomain) |
| GWENHYWFAR_API const char * | GWEN_Logger_Level2Name (GWEN_LOGGER_LEVEL level) |
| GWENHYWFAR_API int | GWEN_Logger_Log (const char *logDomain, GWEN_LOGGER_LEVEL priority, const char *s) |
| GWENHYWFAR_API const char * | GWEN_Logger_Logtype2Name (GWEN_LOGGER_LOGTYPE lt) |
| GWENHYWFAR_API GWEN_LOGGER_LEVEL | GWEN_Logger_Name2Level (const char *name) |
| GWENHYWFAR_API GWEN_LOGGER_LOGTYPE | GWEN_Logger_Name2Logtype (const char *name) |
| GWENHYWFAR_API int | GWEN_Logger_Open (const char *logDomain, const char *ident, const char *file, GWEN_LOGGER_LOGTYPE logtype, GWEN_LOGGER_FACILITY facility) |
| void | GWEN_Logger_SetFilename (const char *logDomain, const char *name) |
| GWENHYWFAR_API void | GWEN_Logger_SetIdent (const char *logDomain, const char *id) |
| GWENHYWFAR_API void | GWEN_Logger_SetLevel (const char *logDomain, GWEN_LOGGER_LEVEL l) |
GWENHYWFAR_API
GWEN_LOGGERFUNCTIONLOG | GWEN_Logger_SetLogFunction (const char *logDomain, GWEN_LOGGERFUNCTIONLOG fn) |
Define Documentation
| #define GWEN_LOGDOMAIN "gwenhywfar" |
Typedef Documentation
Enumeration Type Documentation
- Enumerator:
-
| GWEN_LoggerFacility_Auth |
|
| GWEN_LoggerFacility_Daemon |
|
| GWEN_LoggerFacility_Mail |
|
| GWEN_LoggerFacility_News |
|
| GWEN_LoggerFacility_User |
|
| GWEN_LoggerFacility_Unknown |
|
- Enumerator:
-
| GWEN_LoggerLevel_Emergency |
|
| 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 |
|
- Enumerator:
-
| GWEN_LoggerType_Console |
|
| GWEN_LoggerType_File |
|
| GWEN_LoggerType_Syslog |
|
| GWEN_LoggerType_Function |
|
| GWEN_LoggerType_Unknown |
|
Function Documentation
| GWENHYWFAR_API void GWEN_Logger_Close |
( |
const char * |
logDomain |
) |
|
| GWENHYWFAR_API void GWEN_Logger_Enable |
( |
const char * |
logDomain, |
|
|
int |
f | |
|
) |
| | |
Enables or disables logging.
- Author:
- Martin Preuss<martin@libchipcard.de>
- Parameters:
-
| f | if 0 then logging is disabled, otherwise it is enabled |
| GWENHYWFAR_API int GWEN_Logger_Exists |
( |
const char * |
logDomain |
) |
|
Checks whether a given log domain already exists.
- Returns:
- 1 if it exists, 0 otherwise
| GWENHYWFAR_API int GWEN_Logger_GetLevel |
( |
const char * |
logDomain |
) |
|
| GWENHYWFAR_API int GWEN_Logger_IsEnabled |
( |
const char * |
logDomain |
) |
|
Checks whether logging is enabled.
- Author:
- Martin Preuss<martin@libchipcard.de>
- Returns:
- 0 if disabled, 1 otherwise
| GWENHYWFAR_API int GWEN_Logger_IsOpen |
( |
const char * |
logDomain |
) |
|
Checks whether the logger for the given logDomain is open or not.
Transforms a logger level to an ASCII string (for config files, command line options etc).
| GWENHYWFAR_API int GWEN_Logger_Log |
( |
const char * |
logDomain, |
|
|
GWEN_LOGGER_LEVEL |
priority, |
|
|
const char * |
s | |
|
) |
| | |
Log a message.
- Author:
- Martin Preuss<martin@libchipcard.de>
- Parameters:
-
| priority | priority of the message |
| s | string to log. This string is cut at all occurences of a newline character thus splitting it into multiple log lines if necessary |
Transforms a log type into an ASCII string.
Transforms an ASCII string to a level value.
Transforms an ASCII string into the corresponding log type.
Sets up logging. It automatically enables logging.
- Author:
- Martin Preuss<martin@libchipcard.de>
- Parameters:
-
| ident | this string is prepended to each message logged to identify the logging program |
| file | name of the file to log to. If this is empty and syslog is available, then all messages are logged via syslog. If syslog is not available, all messages are logged to the console. |
| logtype | how to log (via syslog, to a file, to the console etc) |
| facility | what kind of program the log message comes from |
| void GWEN_Logger_SetFilename |
( |
const char * |
logDomain, |
|
|
const char * |
name | |
|
) |
| | |
Set the name of the file to be used when logging to a file.
| GWENHYWFAR_API void GWEN_Logger_SetIdent |
( |
const char * |
logDomain, |
|
|
const char * |
id | |
|
) |
| | |
Set ident string. This string is prepended to every log message and should contain the name of the running program.
- Author:
- Martin Preuss<martin@libchipcard.de>
| GWENHYWFAR_API void GWEN_Logger_SetLevel |
( |
const char * |
logDomain, |
|
|
GWEN_LOGGER_LEVEL |
l | |
|
) |
| | |
Sets the logger level. All messages with a priority up to the given one will be logged, all others will not.
- Author:
- Martin Preuss<martin@libchipcard.de>
- Parameters:
-
| l | maximum level to be logged |
Set logging function. This function is used to log messages in mode LoggerTypeFunction.
- Author:
- Martin Preuss<martin@libchipcard.de>