pub struct Log;Expand description
Logging helpers for access logs and server info.
Log::combined produces standard Combined Log Format lines compatible with
GoAccess, AWStats, and similar tools. All three server code paths (HTTP/1.1,
HTTP/2, HTTP/3) use it.
Implementations§
Source§impl Log
impl Log
pub fn request_response( request: &Request, response: &Response, peer_addr: &SocketAddr, ) -> String
pub fn usage_information() -> String
pub fn info(name: &str) -> String
Sourcepub fn json(
request: &Request,
response: &Response,
peer_addr: &SocketAddr,
) -> String
pub fn json( request: &Request, response: &Response, peer_addr: &SocketAddr, ) -> String
Returns a structured JSON log line for one request/response pair.
Enable with RWS_CONFIG_LOG_FORMAT=json. Useful for log aggregators
(Loki, Fluentd, Datadog) that ingest JSON from pod stdout.
Sourcepub fn log_access(
request: &Request,
response: &Response,
peer_addr: &SocketAddr,
)
pub fn log_access( request: &Request, response: &Response, peer_addr: &SocketAddr, )
Writes one access log line to stdout using the format configured by
RWS_CONFIG_LOG_FORMAT ("combined" or "json"). Call this instead of
Log::combined so that format selection is centralised.
Sourcepub fn combined(
request: &Request,
response: &Response,
peer_addr: &SocketAddr,
) -> String
pub fn combined( request: &Request, response: &Response, peer_addr: &SocketAddr, ) -> String
Returns a Combined Log Format (CLF) line for one request/response pair:
IP - - [DD/Mon/YYYY:HH:MM:SS +0000] "METHOD URI VERSION" STATUS SIZE
pub fn server_url_thread_count( protocol: &str, bind_addr: &String, thread_count: i32, ) -> String
Auto Trait Implementations§
impl Freeze for Log
impl RefUnwindSafe for Log
impl Send for Log
impl Sync for Log
impl Unpin for Log
impl UnsafeUnpin for Log
impl UnwindSafe for Log
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more