Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
c5f83acf
Commit
c5f83acf
authored
Dec 07, 2003
by
Kurt Zeilenga
Browse files
cleanup
parent
f01c60dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/liblber/debug.c
View file @
c5f83acf
...
...
@@ -32,12 +32,6 @@
#include "lber.h"
#include "ldap_pvt.h"
struct
DEBUGLEVEL
{
char
*
subsystem
;
int
level
;
};
int
ldap_loglevels
[
LDAP_SUBSYS_NUM
];
static
FILE
*
log_file
=
NULL
;
...
...
@@ -60,15 +54,15 @@ static int debug2syslog(int l) {
}
#endif
static
char
*
lutil
_levels
[]
=
{
static
char
*
debug
_levels
[]
=
{
"emergency"
,
"alert"
,
"critical"
,
"error"
,
"warning"
,
"notice"
,
"information"
,
"entry"
,
"args"
,
"results"
,
"detail1"
,
"detail2"
,
NULL
};
static
char
*
lutil
_subsys
[
LDAP_SUBSYS_NUM
]
=
{
"GLOBAL"
,
"OPERATION"
,
"TRANSPORT"
,
static
char
*
debug
_subsys
[
LDAP_SUBSYS_NUM
]
=
{
"GLOBAL"
,
"OPERATION"
,
"TRANSPORT"
,
"CONNECTION"
,
"FILTER"
,
"BER"
,
"CONFIG"
,
"ACL"
,
"CACHE"
,
"INDEX"
,
"LDIF"
,
"TOOLS"
,
"SLAPD"
,
"SLURPD"
,
...
...
@@ -79,7 +73,7 @@ int lutil_mnem2subsys( const char *subsys )
{
int
i
;
for
(
i
=
0
;
i
<
LDAP_SUBSYS_NUM
;
i
++
)
{
if
(
!
strcasecmp
(
subsys
,
lutil
_subsys
[
i
]
)
)
{
if
(
!
strcasecmp
(
subsys
,
debug
_subsys
[
i
]
)
)
{
return
i
;
}
}
...
...
@@ -89,9 +83,8 @@ int lutil_mnem2subsys( const char *subsys )
void
lutil_set_all_backends
(
int
level
)
{
int
i
;
for
(
i
=
0
;
i
<
LDAP_SUBSYS_NUM
;
i
++
)
{
if
(
!
strncasecmp
(
"BACK_"
,
lutil
_subsys
[
i
],
sizeof
(
"BACK_"
)
-
1
)
)
{
if
(
!
strncasecmp
(
"BACK_"
,
debug
_subsys
[
i
],
sizeof
(
"BACK_"
)
-
1
)
)
{
ldap_loglevels
[
i
]
=
level
;
}
}
...
...
@@ -100,8 +93,8 @@ void lutil_set_all_backends( int level )
int
lutil_mnem2level
(
const
char
*
level
)
{
int
i
;
for
(
i
=
0
;
lutil
_levels
[
i
]
!=
NULL
;
i
++
)
{
if
(
!
strcasecmp
(
level
,
lutil
_levels
[
i
]
)
)
{
for
(
i
=
0
;
debug
_levels
[
i
]
!=
NULL
;
i
++
)
{
if
(
!
strcasecmp
(
level
,
debug
_levels
[
i
]
)
)
{
return
i
;
}
}
...
...
@@ -227,7 +220,7 @@ void lutil_log( const int subsys, int level, const char *fmt, ... )
va_list
vl
;
va_start
(
vl
,
fmt
);
ber_get_option
(
NULL
,
LBER_OPT_LOG_PRINT_FILE
,
&
outfile
);
lutil_log_int
(
outfile
,
lutil
_subsys
[
subsys
],
level
,
fmt
,
vl
);
lutil_log_int
(
outfile
,
debug
_subsys
[
subsys
],
level
,
fmt
,
vl
);
va_end
(
vl
);
}
...
...
@@ -267,9 +260,9 @@ void lutil_log_initialize(int argc, char **argv)
global_level
=
atoi
(
optarg
);
ldap_loglevels
[
0
]
=
global_level
;
/*
* if a negative number was used, make the global level the
* maximum sane level.
*/
* if a negative number was used, make the global level the
* maximum sane level.
*/
if
(
global_level
<
0
)
{
global_level
=
65535
;
ldap_loglevels
[
0
]
=
65535
;
...
...
@@ -298,16 +291,14 @@ void (lutil_debug)( int debug, int level, const char *fmt, ... )
ber_set_option
(
NULL
,
LBER_OPT_LOG_PRINT_FILE
,
log_file
);
}
#endif
va_start
(
vl
,
fmt
);
va_start
(
vl
,
fmt
);
vsnprintf
(
buffer
,
sizeof
(
buffer
),
fmt
,
vl
);
buffer
[
sizeof
(
buffer
)
-
1
]
=
'\0'
;
if
(
log_file
!=
NULL
)
{
fputs
(
buffer
,
log_file
);
fflush
(
log_file
);
}
fputs
(
buffer
,
stderr
);
va_end
(
vl
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment