Skip to content

Commit 0343fc9

Browse files
committed
fix: ensure ngx_log_error and ngx_conf_log_error correctly filter log levels
currently, the filtering logic incorrectly excludes messages that match exactly the configured log level threshold. the fix corrects the logic. Closes: #266
1 parent 5421ae0 commit 0343fc9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/log.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ macro_rules! ngx_log_error {
9797
( $level:expr, $log:expr, $($arg:tt)+ ) => {
9898
let log = $log;
9999
let level = $level as $crate::ffi::ngx_uint_t;
100-
if level < unsafe { (*log).log_level } {
100+
if level <= unsafe { (*log).log_level } {
101101
let mut buf =
102102
[const { ::core::mem::MaybeUninit::<u8>::uninit() }; $crate::log::LOG_BUFFER_SIZE];
103103
let message = $crate::log::write_fmt(&mut buf, format_args!($($arg)+));
@@ -112,7 +112,7 @@ macro_rules! ngx_conf_log_error {
112112
( $level:expr, $cf:expr, $($arg:tt)+ ) => {
113113
let cf: *mut $crate::ffi::ngx_conf_t = $cf;
114114
let level = $level as $crate::ffi::ngx_uint_t;
115-
if level < unsafe { (*(*cf).log).log_level } {
115+
if level <= unsafe { (*(*cf).log).log_level } {
116116
let mut buf =
117117
[const { ::core::mem::MaybeUninit::<u8>::uninit() }; $crate::log::LOG_BUFFER_SIZE];
118118
let message = $crate::log::write_fmt(&mut buf, format_args!($($arg)+));

0 commit comments

Comments
 (0)