Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LogMessage"/> class.
        /// </summary>
        /// <param name="level">The level of the log message.</param>
        /// <param name="properties">The dictionary that contains the additional properties for the current message.</param>
        /// <param name="provider">The object that provides the culture-specific format information.</param>
        /// <param name="format">The text for the log message.</param>
        /// <param name="formatParameters">The collection of format providers.</param>
        /// <exception cref="ArgumentException">
        ///     Thrown if <paramref name="level"/> is <see cref="LevelToLog.None"/>.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="format"/> is <see langword="null" />.
        /// </exception>
        public LogMessage(
            LevelToLog level,
            IDictionary <string, object> properties,
            IFormatProvider provider,
            string format,
            params object[] formatParameters)
        {
            if (level == LevelToLog.None)
            {
                throw new ArgumentException(Resources.Exceptions_Messages_CannotLogMessageWithLogLevelSetToNone);
            }

            if (format == null)
            {
                throw new ArgumentNullException("format");
            }

            FormatProvider   = provider ?? CultureInfo.InvariantCulture;
            FormatParameters = formatParameters ?? new object[0];
            Level            = level;
            Properties       = (properties != null)
                ? new ReadOnlyDictionary <string, object>(properties)
                : new ReadOnlyDictionary <string, object>(new Dictionary <string, object>());
            Text = format;
        }
Пример #2
0
 /// <summary>
 /// Logs the given message with the given severity.
 /// </summary>
 /// <param name="severity">The importance of the log message.</param>
 /// <param name="message">The message.</param>
 public void Log(LevelToLog severity, string message)
 {
     m_Diagnostics.Log(
         severity,
         UtilitiesConstants.LogPrefix,
         message);
 }
Пример #3
0
 /// <summary>
 /// Logs the given message with the given severity.
 /// </summary>
 /// <param name="severity">The importance of the log message.</param>
 /// <param name="message">The message.</param>
 public void Log(LevelToLog severity, string message)
 {
     m_Diagnostics.Log(
         severity,
         UtilitiesConstants.LogPrefix,
         message);
 }
 /// <summary>
 /// Logs the specified format message with the given arguments and format provider.
 /// </summary>
 /// <param name="severity">The severity for the message.</param>
 /// <param name="provider">An object that provides the culture-specific formatting information.</param>
 /// <param name="format">The string to format.</param>
 /// <param name="parameters">The parameters for the format string.</param>
 public void Log(LevelToLog severity, IFormatProvider provider, string format, params object[] parameters)
 {
     _logger.Log(new LogMessage(severity, provider, format, parameters));
 }
 /// <summary>
 /// Passes the given message to the system loggers.
 /// </summary>
 /// <param name="severity">The severity for the message.</param>
 /// <param name="message">The message.</param>
 public void Log(LevelToLog severity, string message)
 {
     _logger.Log(new LogMessage(severity, message));
 }
Пример #6
0
 /// <summary>
 /// Logs the specified format message with the given arguments and format provider.
 /// </summary>
 /// <param name="severity">The severity for the message.</param>
 /// <param name="provider">An object that provides the culture-specific formatting information.</param>
 /// <param name="format">The string to format.</param>
 /// <param name="parameters">The parameters for the format string.</param>
 public void Log(LevelToLog severity, IFormatProvider provider, string format, params object[] parameters)
 {
     _diagnostics.Log(severity, provider, format, parameters);
 }
Пример #7
0
 /// <summary>
 /// Logs the specified format message with the given arguments. Messages as formatted
 /// with the <see cref="CultureInfo.InvariantCulture"/> as format provider.
 /// </summary>
 /// <param name="severity">The severity for the message.</param>
 /// <param name="format">The string to format.</param>
 /// <param name="parameters">The parameters for the format string.</param>
 public void Log(LevelToLog severity, string format, params object[] parameters)
 {
     _diagnostics.Log(severity, format, parameters);
 }
Пример #8
0
 /// <summary>
 /// Passes the given message to the system loggers.
 /// </summary>
 /// <param name="severity">The severity for the message.</param>
 /// <param name="message">The message.</param>
 public void Log(LevelToLog severity, string message)
 {
     _diagnostics.Log(severity, message);
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogMessage"/> class.
 /// </summary>
 /// <param name="level">The level of the log message.</param>
 /// <param name="text">The text for the log message.</param>
 /// <param name="properties">The dictionary that contains the additional properties for the current message.</param>
 /// <exception cref="ArgumentException">
 ///     Thrown if <paramref name="level"/> is <see cref="LevelToLog.None"/>.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="text"/> is <see langword="null" />.
 /// </exception>
 public LogMessage(LevelToLog level, IDictionary <string, object> properties, string text)
     : this(level, properties, null, text, null)
 {
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogMessage"/> class.
 /// </summary>
 /// <param name="level">The level of the log message.</param>
 /// <param name="provider">The object that provides the culture-specific format information.</param>
 /// <param name="format">The text for the log message.</param>
 /// <param name="formatParameters">The collection of format providers.</param>
 /// <exception cref="ArgumentException">
 ///     Thrown if <paramref name="level"/> is <see cref="LevelToLog.None"/>.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="format"/> is <see langword="null" />.
 /// </exception>
 public LogMessage(LevelToLog level, IFormatProvider provider, string format, params object[] formatParameters)
     : this(level, null, provider, format, formatParameters)
 {
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogMessage"/> class.
 /// </summary>
 /// <param name="level">The level of the log message.</param>
 /// <param name="format">The text for the log message.</param>
 /// <param name="formatParameters">The collection of format providers.</param>
 /// <exception cref="ArgumentException">
 ///     Thrown if <paramref name="level"/> is <see cref="LevelToLog.None"/>.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="format"/> is <see langword="null" />.
 /// </exception>
 public LogMessage(LevelToLog level, string format, params object[] formatParameters)
     : this(level, null, null, format, formatParameters)
 {
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogMessage"/> class.
 /// </summary>
 /// <param name="level">The level of the log message.</param>
 /// <param name="text">The text for the log message.</param>
 /// <exception cref="ArgumentException">
 ///     Thrown if <paramref name="level"/> is <see cref="LevelToLog.None"/>.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="text"/> is <see langword="null" />.
 /// </exception>
 public LogMessage(LevelToLog level, string text)
     : this(level, null, null, text, null)
 {
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogMessage"/> class.
 /// </summary>
 /// <param name="level">The level of the log message.</param>
 /// <param name="properties">The dictionary that contains the additional properties for the current message.</param>
 /// <param name="format">The text for the log message.</param>
 /// <param name="formatParameters">The collection of format providers.</param>
 /// <exception cref="ArgumentException">
 ///     Thrown if <paramref name="level"/> is <see cref="LevelToLog.None"/>.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="format"/> is <see langword="null" />.
 /// </exception>
 public LogMessage(LevelToLog level, IDictionary <string, object> properties, string format, params object[] formatParameters)
     : this(level, properties, null, format, formatParameters)
 {
 }