Thomasdezeeuw / std-logger

A logging implementation for the log crate that logs messages to standard error and requests to standard out.
https://docs.rs/std-logger
Apache License 2.0
9 stars 2 forks source link

Use vectored I/O for key-value pairs #34

Open Thomasdezeeuw opened 3 years ago

Thomasdezeeuw commented 3 years ago

Currently the formatting of key-value pairs doesn't use vectored I/O, but it could. Related code:

https://github.com/Thomasdezeeuw/std-logger/blob/4d2a531d18c37aa7aa179d230c522d2a61cc3096/src/format.rs#L125-L132

https://github.com/Thomasdezeeuw/std-logger/blob/4d2a531d18c37aa7aa179d230c522d2a61cc3096/src/format.rs#L228-L265

Thomasdezeeuw commented 3 years ago

The maximum number of iovec on most OSes is 1024, as defined by the following

#[cfg(any(
    target_os = "dragonfly",
    target_os = "freebsd",
    target_os = "ios",
    target_os = "macos",
    target_os = "netbsd",
    target_os = "openbsd",
))]
const MAX_BUFS: usize = libc::IOV_MAX as usize;

#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))]
const MAX_BUFS: usize = libc::UIO_MAXIOV as usize;