title: DryIoc with Serilog - Setting up Logging Context
body: <p>We're currently using Autofac and are leveraging the AutofacSerilogIntegration to automatically set up the logging context when an ILogger is injected into a concrete.  The integration sets up the logging context with the type the logger is being injected into.  This isn't unreasonably hard in Autofac because there is a "Preparing" event that is available for any resolution...so the resolution of the ILogger can be intercepted and the ILogger can be enhanced at that point and Autofac allows the containing type to be ascertained from this interceptor.  Here is the code:
  <a href="https://github.com/nblumhardt/autofac-serilog-integration/blob/master/src/AutofacSerilogIntegration/ContextualLoggingModule.cs" rel="nofollow">https://github.com/nblumhardt/autofac-serilog-integration/blob/master/src/AutofacSerilogIntegration/ContextualLoggingModule.cs</a></p>
  
  <p>I've seen the availability of interception in DryIoc, but nothing as simple as the Autofac approach.  In DryIoc it looks like the interceptor has to be registered for each concrete that is injected with the type to be is intercepted. 
  <a href="https://bitbucket.org/dadhi/dryioc/wiki/Decorators#markdown-header-decorator-as-interceptor-with-castle-dynamicproxy" rel="nofollow">https://bitbucket.org/dadhi/dryioc/wiki/Decorators#markdown-header-decorator-as-interceptor-with-castle-dynamicproxy</a></p>
  
  <p>Does anybody have advice on the best way to approach this issue in DryIoc? Is this possible in a way that is relatively general and performant?  After looking at the DryIoc documentation, I don't see a straightforward approach to this because I don't see a place where the class that is being injected into can be determined in some kind of generalized interceptor (and which can be globally applied). I obviously don't want to examine the call stack from my logger as this is known to be very slow. </p>
  
  <p>Thanks</p>