chromiumoxide icon indicating copy to clipboard operation
chromiumoxide copied to clipboard

Log raw WS messages to facilitate the debugging

Open MOZGIII opened this issue 2 years ago • 1 comments

MOZGIII avatar Dec 18 '23 03:12 MOZGIII

I'd like to be able to turn these off though, as it's an extra copy on every message; would you consider keeping a feature but making it on by default? That way I can turn it off when needed.

I'm kind of interested in tuning performance here, as we could have a quite overhead-sensitive setup (proper measurements to confirm this are pending).

MOZGIII avatar Dec 18 '23 13:12 MOZGIII

I'd like to be able to turn these off though, as it's an extra copy on every message; would you consider keeping a feature but making it on by default? That way I can turn it off when needed.

Extra cloning can be avoided by this statement.

let msg_for_debug = if tracing::enabled!(target: "chromiumoxide::conn::raw_ws::parse_errors", tracing::Level::DEBUG) {
    Some(msg.clone)
} else {
    None
};

ryo33 avatar Feb 14 '24 08:02 ryo33

I forked this branch and opened https://github.com/mattsse/chromiumoxide/pull/204. It's zero-copy.

ryo33 avatar Feb 14 '24 08:02 ryo33