Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
30576c59
Commit
30576c59
authored
Jul 13, 2000
by
Andreas Gustafsson
Browse files
330. [func] New function isc_log_wouldlog().
parent
ecb2897c
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
30576c59
330. [func] New function isc_log_wouldlog().
329. [func] omapi_auth_register() now takes a size_t argument for
the length of a key's secret data. Previously
OMAPI only stored secrets up to the first NUL byte.
...
...
lib/isc/include/isc/log.h
View file @
30576c59
...
...
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: log.h,v 1.2
5
2000/0
6
/1
9 21:45:03 explorer
Exp $ */
/* $Id: log.h,v 1.2
6
2000/0
7
/1
3 00:18:53 gson
Exp $ */
#ifndef ISC_LOG_H
#define ISC_LOG_H 1
...
...
@@ -627,6 +627,17 @@ isc_log_getdebuglevel(isc_log_t *lctx);
* The current logging debugging level is returned.
*/
isc_boolean_t
isc_log_wouldlog
(
isc_log_t
*
lctx
,
int
level
);
/*
* Determine whether logging something to 'lctx' at 'level' would
* actually cause something to be logged somewhere.
*
* If ISC_FALSE is returned, it is guaranteed that nothing would
* be logged, allowing the caller to omit unnecessary
* isc_log_write() calls and possible message preformatting.
*/
void
isc_log_setduplicateinterval
(
isc_logconfig_t
*
lcfg
,
unsigned
int
interval
);
/*
...
...
lib/isc/log.c
View file @
30576c59
...
...
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: log.c,v 1.3
8
2000/0
6/23 17:52:20 tale
Exp $ */
/* $Id: log.c,v 1.3
9
2000/0
7/13 00:18:51 gson
Exp $ */
/* Principal Authors: DCL */
...
...
@@ -1197,6 +1197,30 @@ isc_log_open(isc_logchannel_t *channel) {
return
(
ISC_R_SUCCESS
);
}
isc_boolean_t
isc_log_wouldlog
(
isc_log_t
*
lctx
,
int
level
)
{
/*
* Try to avoid locking the mutex for messages which can't
* possibly be logged to any channels -- primarily debugging
* messages that the debug level is not high enough to print.
*
* If the level is (mathematically) less than or equal to the
* highest_level, or if there is a dynamic channel and the level is
* less than or equal to the debug level, the main loop must be
* entered to see if the message should really be output.
*
* NOTE: this is UNLOCKED access to the logconfig. However,
* the worst thing that can happen is that a bad decision is made
* about returning without logging, and that's not a big concern,
* because that's a risk anyway if the logconfig is being
* dynamically changed.
*/
return
(
ISC_TF
(
level
<=
lctx
->
logconfig
->
highest_level
||
(
lctx
->
logconfig
->
dynamic
&&
level
<=
lctx
->
debug_level
)));
}
static
void
isc_log_doit
(
isc_log_t
*
lctx
,
isc_logcategory_t
*
category
,
isc_logmodule_t
*
module
,
int
level
,
isc_boolean_t
write_once
,
...
...
@@ -1232,24 +1256,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
REQUIRE
(
category
->
id
<
lctx
->
category_count
);
REQUIRE
(
module
->
id
<
lctx
->
module_count
);
/*
* Try to avoid locking the mutex for messages which can't
* possibly be logged to any channels -- primarily debugging
* messages that the debug level is not high enough to print.
*
* If the level is (mathematically) less than or equal to the
* highest_level, or if there is a dynamic channel and the level is
* less than or equal to the debug level, the main loop must be
* entered to see if the message should really be output.
*
* NOTE: this is UNLOCKED access to the logconfig. However,
* the worst thing that can happen is that a bad decision is made
* about returning without logging, and that's not a big concern,
* because that's a risk anyway if the logconfig is being
* dynamically changed.
*/
if
(
!
(
level
<=
lctx
->
logconfig
->
highest_level
||
(
lctx
->
logconfig
->
dynamic
&&
level
<=
lctx
->
debug_level
)))
if
(
!
isc_log_wouldlog
(
lctx
,
level
))
return
;
time_string
[
0
]
=
'\0'
;
...
...
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