Good point....
At the time I mapped out the ILoggingEvent I was just going to get
people to go "new LoggingEvent(...)" and have some overloaded
constructors to pass in the values.

But because the ILoggingEvent needs to be able to be specific per
implementation (if required), I had to introduce the factory
CreateLoggingEvent().

I guess I didn't go back and re-look at how to populate the
ILoggingEvent properties... I would prefer not to make each one get;
set;.... but I really don't want to add a bunch more methods to add a
bunch more methods to ILogger to handle the overloads for
CreateLoggingEvent. So I am up for any ideas as far as this goes in
the end we may need to make them get; set; to support the required
extensibility...



One thing I was thinking about though was that the change that I
proposed requires new methods to be added to ILogger. I was thinking
that this might break some things if people are implementing there own
ILogger. I still think that this is the best place to put it but an
alternative would be to introduce a new interface called
IEventableLogger. If this was introduced ILogger would stay the same
and IEventableLogger would define the additional methods previously
described:

    public interface IEventableLogger
    {
        void Log(ILoggingEvent loggingEvent);
        ILoggingEvent CreateLoggingEvent();
    }

This interface could even have overloads for the factory
CreateLoggingEvent to handel the setting of the properties.

This interface could then be implemented by any class implements
ILogger would also be changed to implement IEventableLogger as well.
Now I don't think that this is quite as clean as the original solution
described but it does mean that it wouldn't change ILogger.


Lastly I am interested if anyone has any ideas of how to handle the
mapping of the LoggerLevel enum to the specific version for each log
implementation. Besides having a mapping method with a case statement
within each implementation (which I don't think currently exists) I am
all ears.

Cheers
Anthony


On Dec 9, 8:07 am, Gauthier Segay <[EMAIL PROTECTED]> wrote:
> Hello Anthony,
>
> seems like a OK to me.
>
> Also, can you explain how are we setting ILoggingEvent values?
>
> is it from CreateLoggingEvent() with dedicated overloads ?
>
> Thanks
>
> On Dec 8, 1:25 am, vdhant <[EMAIL PROTECTED]> wrote:
>
> > Hi guys
> > In reference to the specifications I provided in my last, can I take
> > this as a go ahead for the changes that need to occur???
> > Cheers
> > Anthony
>
> > On Dec 5, 12:15 pm, vdhant <[EMAIL PROTECTED]> wrote:
>
> > > Hey guys
> > > I have sent a little bit of time putting down on paper the changes/
> > > additions that this unit of work will include.
> > > Let me know what you think and I hope it pretty much makes sense
> > > Cheers
> > > Anthony
>
> > > //Change to ILogger interface
> > > // -- Castle.Core.Logging
> > >     public interface ILogger
> > >     {
> > >         ....
> > >         void Log(ILoggingEvent loggingEvent);
>
> > >         ILoggingEvent CreateLoggingEvent();   //If anyone know a
> > > better place to get the instance from please let me know
> > >         ....
> > >     }
>
> > > //New ILoggingEvent interface
> > > // -- Castle.Core.Logging
> > >     public interface ILoggingEvent
> > >     {
> > >         Type DeclaringType { get; }
>
> > >         LoggerLevel LoggerLevel { get; }
>
> > >         String LoggerName { get; }
>
> > >         String Message { get; }
>
> > >         Exception Exception { get; }
> > >     }
>
> > > //New IExtendedLoggingEvent interface
> > > // -- Castle.Core.Logging
> > >     public interface IExtendedLoggingEvent : ILoggingEvent
> > >     {
> > >         IKeyContextProperties Properties { get; }
> > >     }
>
> > > //New IKeyContextProperties interface
> > > // -- Castle.Core.Logging
> > >     public interface IKeyContextProperties : IContextProperties,
> > > IDictionary
> > >     {
> > >     }
>
> > > //New NullLoggingEvent class
> > > // -- Castle.Core.Logging
> > >     public class LoggingEvent : ILoggingEvent
> > >     {
> > >         ....
> > >     }
>
> > > //New NullLoggingEvent class
> > > // -- Castle.Core.Logging
> > >     public class NullLoggingEvent : IExtendedLoggingEvent
> > >     {
> > >         ....
> > >     }
>
> > > //New NullKeyContextProperties Class
> > > // -- Castle.Core.Logging
> > >     public class NullKeyContextProperties : IKeyContextProperties
> > >     {
> > >         ....
> > >     }
>
> > > //New LoggingEvent Class
> > > // -- Castle.Services.Logging.Log4netIntegration
> > >     public class LoggingEvent : Castle.Core.Logging.LoggingEvent
> > >     {
> > >         private log4Net.Core.LoggingEvent _InnerLoggingEvent;
> > >         ....
> > >         public LoggingEvent(Type declaringType, LoggerLevel
> > > loggerLevel, String loggerName, String message, Exception exception)
> > >         {
> > >            _InnerLoggingEvent = new log4Net.Core.LoggingEvent
> > > (declaringType, loggerLevel, loggerName, message, exception);
> > >         }
> > >         ....
> > >         public log4Net.Core.LoggingEvent InnerLoggingEvent
> > >         {
> > >             get { return _InnerLoggingEvent; }
> > >         }
> > >         ....
> > >     }
>
> > > //New ExtendedLoggingEvent Class
> > > // -- Castle.Services.Logging.Log4netIntegration
> > >     public class ExtendedLoggingEvent :
> > > Castle.Services.Logging.Log4netIntegration.LoggingEvent,
> > > IExtendedLoggingEvent
> > >     {
> > >         private IKeyContextProperties _Properties;
> > >         ....
> > >         public ExtendedLoggingEvent(Type declaringType, LoggerLevel
> > > loggerLevel, String loggerName, String message, Exception exception)
> > >             : base(declaringType, loggerLevel, loggerName, message,
> > > exception)
> > >         {
> > >         }
> > >         ....
> > >         public IKeyContextProperties Properties
> > >         {
> > >             if (_Properties == null)
> > >                 _Properties = new LocalContextProperties
> > > (this.InnerLoggingEvent.Properties);
> > >             return _Properties;
> > >         }
> > >         ....
> > >     }
>
> > > //New LocalContextProperties Class
> > > // -- Castle.Services.Logging.Log4netIntegration
> > >     public class LocalContextProperties : IKeyContextProperties
> > >     {
> > >         private log4net.Util.PropertiesDictionary _InnerProperties;
> > >         ....
> > >         public LocalContextProperties
> > > (log4net.Util.PropertiesDictionary innerProperties)
> > >         {
> > >             _InnerProperties = innerProperties;
> > >         }
> > >         ....
> > >         public object this[string key]
> > >         {
> > >             get { return _InnerProperties.Properties[key]; }
> > >             set { _InnerProperties.Properties[key] = value; }
> > >         }
> > >         ....
> > >     }
>
> > > //Changes to Log4netLogger Class
> > > // -- Castle.Services.Logging.Log4netIntegration
> > >     public class Log4netLogger
> > >     {
> > >         ....
> > >         public override ILoggingEvent CreateLoggingEvent()
> > >         {
> > >             return new LoggingEvent();
> > >         }
> > >         ....
> > >         void override Log(ILoggingEvent loggingEvent)
> > >         {
> > >             Castle.Services.Logging.Log4netIntegration.LoggingEvent
> > > innerLoggingEvent = loggingEvent as
> > > Castle.Services.Logging.Log4netIntegration.LoggingEvent();
> > >             if (innerLoggingEvent == null)
> > >                 throw new Exception("Wrong Type");
>
> > >             Logger.Log(innerLoggingEvent.InnerLoggingEvent);
> > >         }
> > >         ....
> > >     }
>
> > > //Changes to ExtendedLog4netLogger Class
> > > // -- Castle.Services.Logging.Log4netIntegration
> > >     public class ExtendedLog4netLogger
> > >     {
> > >         ....
> > >         public override ILoggingEvent CreateLoggingEvent()
> > >         {
> > >             return new ExtendedLoggingEvent();
> > >         }
> > >         ....
> > >     }
>
> > > //New ExtendedLoggingEvent Class
> > > // -- Castle.Services.Logging.NLogtIntegration
> > >     public class LoggingEvent : Castle.Core.Logging.LoggingEvent
> > >     {
> > >         ....
> > >         //Similar implementation pattern as Log4Net version except for
> > > nLog
> > >         ....
> > >     }
>
> > > //New ExtendedLoggingEvent Class
> > > // -- Castle.Services.Logging.NLogtIntegration
> > >     public class ExtendedLoggingEvent :
> > > Castle.Services.Logging.NLogtIntegration.LoggingEvent,
> > > IExtendedLoggingEvent
> > >     {
> > >         ....
> > >         //Similar implementation pattern as Log4Net version except for
> > > nLog
> > >         ....
> > >     }
>
> > > //New LocalContextProperties Class
> > > // -- Castle.Services.Logging.NLogtIntegration
> > >     public class LocalContextProperties : IKeyContextProperties
> > >     {
> > >         ....
> > >         //Similar implementation pattern as Log4Net version except for
> > > nLog
> > >         ....
> > >     }
>
> > > //Changes to NLogLogger Class
> > > // -- Castle.Services.Logging.NLogtIntegration
> > >     public class NLogLogger
> > >     {
> > >         ....
> > >         //Similar implementation pattern as Log4Net version except for
> > > nLog
> > >         ....
> > >     }
>
> > > //Changes to ExtendedNLogLogger Class
> > > // -- Castle.Services.Logging.NLogtIntegration
> > >     public class ExtendedNLogLogger
> > >     {
> > >         ....
> > >         //Similar implementation pattern as Log4Net version except for
> > > nLog
> > >         ....
> > >     }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to