slog icon indicating copy to clipboard operation
slog copied to clipboard

Request for convenience function

Open aklitzke opened this issue 4 years ago • 1 comments

Might be nice to have something like:

use slog_scope::*;
new_scope!("key" => "value", || {
  info!("hi");
});

that is shorthand for:

use slog_scope::*;
with_logger(|logger| {
  scope(logger.new(o!("key" => "value")), || {
    info!("hi")
  });
});

aklitzke avatar Jan 15 '20 19:01 aklitzke

I'd call it with_keys, but :+1: from me. Submit a PR and it will be there. :)

dpc avatar Jan 15 '20 20:01 dpc