nginx/ngx-rust

Provide more logging macros

Closed this issue · 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!.

jmccl commented

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