ngx-rust icon indicating copy to clipboard operation
ngx-rust copied to clipboard

Provide more logging macros

Open f5yacobucci opened this issue 1 year ago • 1 comments

ngx-rust doesn't provide a full set of convenience macros for logging.

We support specific debug logging, but for other logging the user still needs to call the C FFI functions themselves. Needing to provide unnecessary arguments, e.g., in the upstream.rs module example:

ngx_conf_log_error(
            NGX_LOG_EMERG as usize,
            cf,
            0,
            "CUSTOM UPSTREAM no upstream srv_conf".as_bytes().as_ptr() as *const i8,
       );

This can be simplified with a corresponding macro like we do for ngx_log_debug!.

f5yacobucci avatar Sep 01 '23 19:09 f5yacobucci

As an aside 'eprintln!' goes to the error log which is pretty useful, although not what you're proposing.

jmccl avatar May 12 '24 21:05 jmccl