mschilli / log4perl

Log4j Implementation For Perl
http://log4perl.com
Other
116 stars 66 forks source link

it would be cool if MDC->put accepts multiple key value pairs #125

Open klaernie opened 1 year ago

klaernie commented 1 year ago

It would be really nice if one could pass in multiple key value pairs at the same time:

Log::Log4perl::MDC->put(
       foo_http_code => $code,
       foo_http_msg => $msg,
);

Right now it needs to be coded this way in order to be working:

Log::Log4perl::MDC->put( foo_http_code => $code );
Log::Log4perl::MDC->put( foo_http_msg => $msg );

Sadly I stumbled over this after debugging my way through our stack, until I noticed that always just the first pair was being passed on. Well, that's what I get for rushing to switch to log4perl.

From a cursory look it seems like it should be fairly easy to implement, and even be a good beginner PR. I'll try to implement this myself, unless I totally forget.