Пример #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);
            }
        }
Пример #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()));
            }
        }