Exemplo n.º 1
0
        /// <summary>
        /// Log the message and exception, on the defined level
        /// </summary>
        /// <param name="level">The level of the info</param>
        /// <param name="message">The message to log</param>
        /// <param name="exception">The exception to log</param>
        private void Log(log4net.Core.Level level, object message, Exception exception)
        {
            log4net.Core.LoggingEvent loggingEvent;
            loggingEvent = new log4net.Core.LoggingEvent(
                this.declaringType,
                this.log.Logger.Repository,
                this.log.Logger.Name,
                level,
                message,
                exception);

            SourceData data = this.sourceDataRetriver.SourceData(3);

            loggingEvent.Properties[SourceModule] = data.ModuleName;
            loggingEvent.Properties[SourceClass]  = data.ClassName;
            loggingEvent.Properties[SourceMethod] = data.MethodName;
            loggingEvent.Properties[SourceLine]   = data.Line;

            this.log.Logger.Log(loggingEvent);
        }