Пример #1
0
Файл: GDC.cs Проект: WS-QA/Nlog
 /// <summary>
 /// Clears the content of the GDC.
 /// </summary>
 public static void Clear()
 {
     GlobalDiagnosticsContext.Clear();
 }
Пример #2
0
 /// <summary>
 /// Gets the current thread MDC named item.
 /// </summary>
 /// <param name="item">Item name.</param>
 /// <param name="formatProvider">The <see cref="IFormatProvider"/> to use when converting a value to a string.</param>
 /// <returns>The value of <paramref name="item"/>, if defined; otherwise <see cref="String.Empty"/>.</returns>
 public static string Get(string item, IFormatProvider formatProvider)
 {
     return(GlobalDiagnosticsContext.ConvertToString(GetObject(item), formatProvider));
 }
Пример #3
0
Файл: GDC.cs Проект: WS-QA/Nlog
 /// <summary>
 /// Checks whether the specified item exists in the Global Diagnostics Context.
 /// </summary>
 /// <param name="item">Item name.</param>
 /// <returns>A boolean indicating whether the specified item exists in current thread GDC.</returns>
 public static bool Contains(string item)
 {
     return(GlobalDiagnosticsContext.Contains(item));
 }
Пример #4
0
Файл: GDC.cs Проект: WS-QA/Nlog
 /// <summary>
 /// Removes the specified item from the Global Diagnostics Context.
 /// </summary>
 /// <param name="item">Item name.</param>
 public static void Remove(string item)
 {
     GlobalDiagnosticsContext.Remove(item);
 }
Пример #5
0
Файл: GDC.cs Проект: WS-QA/Nlog
 /// <summary>
 /// Gets the Global Diagnostics Context named item.
 /// </summary>
 /// <param name="item">Item name.</param>
 /// <returns>The item value of string.Empty if the value is not present.</returns>
 public static string Get(string item)
 {
     return(GlobalDiagnosticsContext.Get(item));
 }
Пример #6
0
Файл: GDC.cs Проект: WS-QA/Nlog
 /// <summary>
 /// Sets the Global Diagnostics Context item to the specified value.
 /// </summary>
 /// <param name="item">Item name.</param>
 /// <param name="value">Item value.</param>
 public static void Set(string item, string value)
 {
     GlobalDiagnosticsContext.Set(item, value);
 }
Пример #7
0
 /// <summary>
 /// Gets the Global Diagnostics Context item.
 /// </summary>
 /// <param name="item">Item name.</param>
 /// <param name="formatProvider"><see cref="IFormatProvider"/> to use when converting the item's value to a string.</param>
 /// <returns>The value of <paramref name="item"/> as a string, if defined; otherwise <see cref="String.Empty"/>.</returns>
 /// <remarks>If <paramref name="formatProvider"/> is <c>null</c> and the value isn't a <see cref="string"/> already, this call locks the <see cref="LogFactory"/> for reading the <see cref="LoggingConfiguration.DefaultCultureInfo"/> needed for converting to <see cref="string"/>. </remarks>
 public static string Get(string item, IFormatProvider formatProvider)
 {
     return(GlobalDiagnosticsContext.Get(item, formatProvider));
 }
Пример #8
0
 /// <summary>
 /// Gets all messages from the stack, without removing them.
 /// </summary>
 /// <param name="formatProvider">The <see cref="IFormatProvider"/> to use when converting a value to a string.</param>
 /// <returns>Array of strings.</returns>
 public static string[] GetAllMessages(IFormatProvider formatProvider)
 {
     return(ThreadStack.Select((o) => GlobalDiagnosticsContext.ConvertToString(o, formatProvider)).ToArray());
 }
Пример #9
0
 /// <summary>
 /// Pops the top message from the NDC stack.
 /// </summary>
 /// <param name="formatProvider">The <see cref="IFormatProvider"/> to use when converting the value to a string.</param>
 /// <returns>The top message, which is removed from the stack, as a string value.</returns>
 public static string Pop(IFormatProvider formatProvider)
 {
     return(GlobalDiagnosticsContext.ConvertToString(PopObject(), formatProvider));
 }