PingAccess Agent SDK for C
paa-log.h
Go to the documentation of this file.
1 /*****************************************************
2  * Copyright (C) 2015 Ping Identity Corporation
3  * All rights reserved.
4  *
5  * The contents of this file are the property of Ping Identity Corporation.
6  * You may not copy or use this file, in either source code or executable
7  * form, except in compliance with terms set by Ping Identity Corporation.
8  * For further information please contact:
9  *
10  * Ping Identity Corporation
11  * 1001 17th St Suite 100
12  * Denver, CO 80202
13  * 303.468.2900
14  * http://www.pingidentity.com
15  *
16  ****************************************************/
17 
30 #ifndef _PAA_SDK_PAA_LOG_H_
31 #define _PAA_SDK_PAA_LOG_H_ 1
32 
33 #include <stdarg.h>
34 
35 #include "apr.h"
36 #include "apr_pools.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
64 typedef enum paa_log_level_e {
65  PAA_OFF = 0,
66  PAA_ERROR = 1,
67  PAA_WARN = 2,
68  PAA_INFO = 3,
69  PAA_MONITOR = 4,
70  PAA_DEBUG = 5,
71  PAA_TRACE = 6
73 
85 paa_log_level paa_str_to_level(const char *level_str);
86 
94 const char *paa_level_str(paa_log_level level);
95 
100 
108 
122 typedef void (*paa_log_function)(const char *file,
123  int line,
124  apr_pool_t *pool,
125  const char *msgid,
126  paa_log_level level,
127  apr_status_t error_code,
128  const char *format, va_list va_args);
129 
144 void paa_log_msg(const char *file,
145  int line,
146  apr_pool_t *pool,
147  const char *msgid,
148  paa_log_level level,
149  apr_status_t error_code,
150  const char *format, ...);
151 
165 void paa_set_log_functions(paa_log_function log_function,
166  paa_log_level_function level_function);
167 
172 #define paa_log(pool, msgid, level, format, ...)\
173  do {\
174  paa_log_msg(__FILE__, __LINE__, pool, msgid, level, 0, format, ## __VA_ARGS__);\
175  }while(0)
176 
181 #define paa_log_error(pool, msgid, level, error_code, format, ...)\
182  do{\
183  paa_log_msg(__FILE__, __LINE__, pool, msgid, level, error_code, format, ## __VA_ARGS__);\
184  }while(0)
185 
186 
187 #ifdef __cplusplus
188 } /* C */
189 #endif
190 
191 #endif /* _PAA_SDK_PAA_LOG_H_ */
void paa_log_msg(const char *file, int line, apr_pool_t *pool, const char *msgid, paa_log_level level, apr_status_t error_code, const char *format,...)
paa_log_level_e
Definition: paa-log.h:64
void(* paa_log_function)(const char *file, int line, apr_pool_t *pool, const char *msgid, paa_log_level level, apr_status_t error_code, const char *format, va_list va_args)
Definition: paa-log.h:122
paa_log_level(* paa_log_level_function)()
Definition: paa-log.h:99
paa_log_level paa_str_to_level(const char *level_str)
paa_log_level paa_get_log_level()
enum paa_log_level_e paa_log_level
const char * paa_level_str(paa_log_level level)
void paa_set_log_functions(paa_log_function log_function, paa_log_level_function level_function)