Ok. Ley me rework it following your suggestions, which are nice. I didn't
think that.

But let me tell you that I don't think it's good to format messages early
in the adapter, the Akka levels aren't enough for filtering log events, you
can have finer filtering, by source for instance, in the underlying logging
framework configuration.

I will try to have something committed today.

Cheers!

Gastón.
TW: @ktonga
L-in: http://www.linkedin.com/in/gastontonietti
Meetup: http://www.meetup.com/scala_ar/

Enviado desde mi Claro Samsung Galaxy S4.
On Oct 22, 2013 8:35 AM, "Patrik Nordwall" <notifications@github.com> wrote:

> In akka-slf4j/src/main/scala/akka/event/slf4j/Slf4jLogger.scala:
>
> > @@ -46,6 +46,24 @@ object Logger {
> >  }
> >
> >  /**
> > + * Used as message parameter for LoggingAdapter methods error(Any), warning(Any), info(Any) and debug(Any)
> > + * to specify extra MDC values:
> > + *
> > + * {{{
> > + * val log: LoggingAdapter = ...
> > + * log.info(MsgWithMDC("Doing something", Map("requestId" -> reqId, "transactionId" -> txId)))
> > + *
> > + * // In logback pattern
> > + * %level %logger [%X{requestId}, %X{transactionId}] - %msg%n
> > + * }}}
> > + * @param msg Log message of any type, toString method will be called if it is not a String (useful for differing formatting)
> > + * @param mdc A Map with extra values to be added to MDC when appending the log
> > + */
> > +case class MsgWithMDC(msg: Any, mdc: Map[String, Any]) {
>
> I don't think changing the signatures from String to Any to be able to
> pass in this MsgWithMDC is the best way to do it. All the methods that
> takes template and args are not covered by this, i.e. the combination of
> mdc and template is not supported.
> I think MDC is something that is expected to be passed outside of the
> actual log statements (normally a thread local). We will probably not
> support it as a thread local, but I'm thinking if it can be passed in when
> constructing the LoggingAdapter. Probably not the actual MDC instance, but
> a function that can produce the MDC instance.
>
> It must also be java friendly.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/akka/akka/pull/1787/files#r7122553>
> .
>