Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public virtual void Log(LoggingEvent.Severity severity, params object[] arguments)
        {
            /*
             * This overridable method creates a LoggingEvent, populates its properties and passes it to the Handle method for handling.
             * If a module does not exist to handle an IEvent of type LoggingEvent logging will fail silently. If we were to attempt
             * logging of a failed LoggingEvent we would create an infinite loop of logging fails... I hear StackOverflowException.
             */

            if (arguments != null && arguments.Length > 0)
            {
                // We insert the application name at index 0 of the arguments array so that it can be output by the LoggingEvent event handler.
                var loggingEvent = new LoggingEvent();
                loggingEvent.Input = new LoggingEventInput()
                {
                    Severity  = severity,
                    Arguments = arguments.ToList()
                };

                loggingEvent.Input.Arguments.Insert(0, this.ApplicationName);
                Handle(loggingEvent);
            }
        }
 public void Log(LoggingEvent.Severity severity, params object[] args)
 {
     Module.Log(severity, args);;
 }