Add another log level, PAM_LOG_LIBDEBUG, with a negative priority. It
is currently equivalent to PAM_LOG_DEBUG, and is used only by the library call tracing macros (ENTER*() and RETURN*()). It should eventually replace PAM_LOG_DEBUG throughout the library, except perhaps for a few particularly interesting messages; PAM_LOG_DEBUG will be reserved for modules. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@522 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
df3d585d08
commit
b616ada557
|
@ -163,6 +163,7 @@ openpam_readline(FILE *_f,
|
|||
* Log levels
|
||||
*/
|
||||
enum {
|
||||
PAM_LOG_LIBDEBUG = -1,
|
||||
PAM_LOG_DEBUG,
|
||||
PAM_LOG_VERBOSE,
|
||||
PAM_LOG_NOTICE,
|
||||
|
|
|
@ -39,53 +39,53 @@
|
|||
#define OPENPAM_DEBUG_INCLUDED
|
||||
|
||||
#ifdef OPENPAM_DEBUG
|
||||
#define ENTER() openpam_log(PAM_LOG_DEBUG, "entering")
|
||||
#define ENTER() openpam_log(PAM_LOG_LIBDEBUG, "entering")
|
||||
#define ENTERI(i) do { \
|
||||
int i_ = (i); \
|
||||
if (i_ > 0 && i_ < PAM_NUM_ITEMS) \
|
||||
openpam_log(PAM_LOG_DEBUG, "entering: %s", pam_item_name[i_]); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "entering: %s", pam_item_name[i_]); \
|
||||
else \
|
||||
openpam_log(PAM_LOG_DEBUG, "entering: %d", i_); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "entering: %d", i_); \
|
||||
} while (0)
|
||||
#define ENTERN(n) do { \
|
||||
int n_ = (n); \
|
||||
openpam_log(PAM_LOG_DEBUG, "entering: %d", n_); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "entering: %d", n_); \
|
||||
} while (0)
|
||||
#define ENTERS(s) do { \
|
||||
const char *s_ = (s); \
|
||||
if (s_ == NULL) \
|
||||
openpam_log(PAM_LOG_DEBUG, "entering: NULL"); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "entering: NULL"); \
|
||||
else \
|
||||
openpam_log(PAM_LOG_DEBUG, "entering: '%s'", s_); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "entering: '%s'", s_); \
|
||||
} while (0)
|
||||
#define RETURNV() openpam_log(PAM_LOG_DEBUG, "returning")
|
||||
#define RETURNV() openpam_log(PAM_LOG_LIBDEBUG, "returning")
|
||||
#define RETURNC(c) do { \
|
||||
int c_ = (c); \
|
||||
if (c_ >= 0 && c_ < PAM_NUM_ERRORS) \
|
||||
openpam_log(PAM_LOG_DEBUG, "returning %s", pam_err_name[c_]); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "returning %s", pam_err_name[c_]); \
|
||||
else \
|
||||
openpam_log(PAM_LOG_DEBUG, "returning %d!", c_); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "returning %d!", c_); \
|
||||
return (c_); \
|
||||
} while (0)
|
||||
#define RETURNN(n) do { \
|
||||
int n_ = (n); \
|
||||
openpam_log(PAM_LOG_DEBUG, "returning %d", n_); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "returning %d", n_); \
|
||||
return (n_); \
|
||||
} while (0)
|
||||
#define RETURNP(p) do { \
|
||||
void *p_ = (p); \
|
||||
if (p_ == NULL) \
|
||||
openpam_log(PAM_LOG_DEBUG, "returning NULL"); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "returning NULL"); \
|
||||
else \
|
||||
openpam_log(PAM_LOG_DEBUG, "returning %p", p_); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "returning %p", p_); \
|
||||
return (p_); \
|
||||
} while (0)
|
||||
#define RETURNS(s) do { \
|
||||
const char *s_ = (s); \
|
||||
if (s_ == NULL) \
|
||||
openpam_log(PAM_LOG_DEBUG, "returning NULL"); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "returning NULL"); \
|
||||
else \
|
||||
openpam_log(PAM_LOG_DEBUG, "returning '%s'", s_); \
|
||||
openpam_log(PAM_LOG_LIBDEBUG, "returning '%s'", s_); \
|
||||
return (s_); \
|
||||
} while (0)
|
||||
#else
|
||||
|
|
|
@ -71,6 +71,7 @@ openpam_log(int level, const char *fmt, ...)
|
|||
int priority;
|
||||
|
||||
switch (level) {
|
||||
case PAM_LOG_LIBDEBUG:
|
||||
case PAM_LOG_DEBUG:
|
||||
if (!openpam_debug)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue