Beispiel #1
0
        /// <summary>
        /// Log information (parameters &amp; return value)
        /// </summary>
        /// <param name="logger">Logger object to use</param>
        /// <param name="logLocation">Standard location</param>
        /// <param name="logLevel">Log level</param>
        /// <param name="logInfo">Log information holder</param>
        protected void Log(ILog logger,
                           LogStandardLocation logLocation,
                           LogLevel logLevel,
                           LogInfo logInfo)
        {
            try
            {
                //==============================================================
                // Append standard location to parameters
                //==============================================================
                if (logger == null)
                {
                    throw new ArgumentNullException("Logger", "Logger cannot be a null reference");
                }
                else
                {

                    AppendStandardLocation(logInfo, logLocation);

                    //==============================================================
                    // Log method info in the requested level
                    //==============================================================
                    LogMessageByLevel(logger,
                                      logInfo.ToString(),
                                      logLevel);
                }
            }
            catch (Exception exception)
            {
                //==============================================================
                // Handle logging error
                //==============================================================
                HandleLoggingError(exception);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Appends the standard location.
        /// </summary>
        /// <param name="logInfo">Obj log info.</param>
        /// <param name="location">Enm location.</param>
        protected static void AppendStandardLocation(LogInfo logInfo,
                                                     LogStandardLocation location)
        {
            //==============================================================
            // Add standard socation
            //==============================================================
            if (logInfo == null)
            {
                throw new ArgumentNullException("logInfo", "logInfo cannot be a null reference");
            }
            else
            {

                logInfo.InsertFirst(new LogParameter("Location", location.ToString()));
            }
        }
Beispiel #3
0
 /// <summary>
 /// Appends the method properties.
 /// </summary>
 /// <param name="logInfo">Obj log info.</param>
 /// <param name="callingMethod">Obj calling method.</param>
 protected void AppendMethodProperties(LogInfo logInfo,
                                       MethodBase callingMethod)
 {
     //==============================================================
     // Add method's name
     //==============================================================
     if (logInfo == null)
     {
         throw new ArgumentNullException("loginfo", "Location can not be null");
     }
     else
     {
         logInfo.InsertFirst(new LogParameter("Method", callingMethod.Name));
     }
 }
Beispiel #4
0
 /// <summary>
 /// Logs any free log info in Warning level
 /// </summary>
 /// <param name="logInfo">Logging information</param>
 public void WarnLog(LogInfo logInfo)
 {
     //==============================================================
     // Log Method Entry (Warn Level)
     //==============================================================
     Log(mobjActiveLogger, LogLevel.Warn, logInfo);
 }
Beispiel #5
0
 /// <summary>
 /// Logs a method's exit including parameter values
 /// </summary>
 /// <param name="logInfo">Logging information</param>
 public void LogMethodExit(LogInfo logInfo)
 {
     //==============================================================
     // Log Method Entry (Debug Level)
     //==============================================================
     Log(mobjActiveLogger, LogStandardLocation.MethodExit, LogLevel.Debug, logInfo);
 }
Beispiel #6
0
        /// <summary>
        /// Logs a method's critical point including parameter values
        /// </summary>
        /// <param name="logger">Logger object to use</param>
        /// <param name="callingMethod">Calling method reflection</param>
        /// <param name="logInfo">Logging information</param>
        public void LogMethodCriticalPoint(ILog logger,
                                           MethodBase callingMethod,
                                           LogInfo logInfo)
        {
            //==============================================================
            // Append method name to parameters
            //==============================================================
            AppendMethodProperties(logInfo, callingMethod);

            //==============================================================
            // Log Method Entry (Debug Level)
            //==============================================================
            Log(logger, LogStandardLocation.MethodCriticalPoint, LogLevel.Debug, logInfo);
        }
Beispiel #7
0
 /// <summary>
 /// Logs any free log info in Info level
 /// </summary>
 /// <param name="logInfo">Logging information</param>
 public void InfoLog(LogInfo logInfo)
 {
     //==============================================================
     // Log Method Entry (Info Level)
     //==============================================================
     Log(mobjActiveLogger, LogLevel.Info, logInfo);
 }
Beispiel #8
0
 /// <summary>
 /// Logs any free log info in Debug level
 /// </summary>
 /// <param name="logInfo">Logging information</param>
 public void DebugLog(LogInfo logInfo)
 {
     //==============================================================
     // Log Method Entry (Debug Level)
     //==============================================================
     Log(mobjActiveLogger, LogLevel.Debug, logInfo);
 }