Tracer and MEF

Topics: Logging Application Block
Jul 7, 2010 at 1:46 PM


How can we use the Tracer class with MEF ?


Thank you,

Adrien Pellegrini.

Jul 7, 2010 at 6:57 PM

In what way do you want to "use the Tracer class with MEF?"

Inject tracers into objects as parts? You can't (and it'd be the wrong thing to do anyway). Use Tracer to instrument MEF itself? Use Tracer inside your MEF parts? Use MEF under the hood of Entlib?

To all of these, the answer is "MEF probably makes it really hard," but depending on what you want it's probably achievable.


Jul 8, 2010 at 6:39 AM

In fact I have a Logger class that can be injected into objects as parts. I want the same way for the tracer class.


Here is my Logger class:

public class LoggerAdapter : ILoggerFacade
        void Writer(
            Category category,
            TraceEventType severity,
            Priority priority,
            Int32 eventId,
            String message,
            ModuleResources moduleName)
            ValiLogEntry entry = new ValiLogEntry();
            entry.Message = message;
            entry.Severity = severity;
            entry.Priority = (Int32)priority;
            entry.EventId = eventId;

            entry.ModuleName = moduleName;



But I was unable to find something well to do that. In fact I don't want to reference the entlib dll directly in my projects (but only in my custom Logging projects that use the entlib logging application block).

Jul 12, 2010 at 6:07 AM

Any idea ?

I don't find something proper than reference directly the dll ...