diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs index 34f8935ac470cd..9b833bb16a4ce0 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs @@ -226,3 +226,45 @@ public interface IBufferedLogger void LogRecords(System.Collections.Generic.IEnumerable records); } } +namespace Microsoft.Extensions.Logging.Abstractions.Internal +{ + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This type is retained only for compatibility.", error: true)] + public partial class NullScope : System.IDisposable + { + private NullScope() { } + public static Microsoft.Extensions.Logging.Abstractions.Internal.NullScope Instance { get { throw null; } } + public void Dispose() { } + } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This type is retained only for compatibility.", error: true)] + public partial class TypeNameHelper + { + public static string GetTypeDisplayName(System.Type type) { throw null; } + } +} +namespace Microsoft.Extensions.Logging.Internal +{ + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This type is retained only for compatibility. The recommended alternative is the Microsoft.Extensions.Diagnostics.Testing package.", error: true)] + public partial class FormattedLogValues : System.Collections.Generic.IEnumerable>, System.Collections.Generic.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyList>, System.Collections.IEnumerable + { + public FormattedLogValues(string? format, params object?[]? values) { } + public int Count { get { throw null; } } + public System.Collections.Generic.KeyValuePair this[int index] { get { throw null; } } + public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public override string ToString() { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This type is retained only for compatibility. The recommended alternative is the Microsoft.Extensions.Diagnostics.Testing package.", error: true)] + public partial class LogValuesFormatter + { + public LogValuesFormatter(string format) { } + public string OriginalFormat { get { throw null; } } + public System.Collections.Generic.List ValueNames { get { throw null; } } + public string Format(object?[]? values) { throw null; } + public System.Collections.Generic.KeyValuePair GetValue(object?[] values, int index) { throw null; } + public System.Collections.Generic.IEnumerable> GetValues(object[] values) { throw null; } + } +} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.csproj index 19f520bbca8999..68eb86172fedb3 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.csproj @@ -14,6 +14,7 @@ + diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/FormattedLogValuesObsolete.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/FormattedLogValuesObsolete.cs new file mode 100644 index 00000000000000..179e251bb9de91 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/FormattedLogValuesObsolete.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; + +namespace Microsoft.Extensions.Logging.Internal +{ + /// + /// LogValues to enable formatting options supported by . + /// This also enables using {NamedFormatItem} in the format string. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This type is retained only for compatibility. The recommended alternative is the Microsoft.Extensions.Diagnostics.Testing package.", error: true)] + public class FormattedLogValues : IReadOnlyList> + { + private Microsoft.Extensions.Logging.FormattedLogValues _inner; + + /// + /// Initializes a new instance of the class. + /// + /// The format string. + /// The values. + public FormattedLogValues(string? format, params object?[]? values) + { + _inner = new Microsoft.Extensions.Logging.FormattedLogValues(format, values); + } + + /// + public KeyValuePair this[int index] => _inner[index]; + + /// + public int Count => _inner.Count; + + /// + public IEnumerator> GetEnumerator() => _inner.GetEnumerator(); + + /// + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + + /// + public override string ToString() => _inner.ToString(); + } +} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatterObsolete.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatterObsolete.cs new file mode 100644 index 00000000000000..2cb2c1475513bf --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatterObsolete.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.ComponentModel; + +namespace Microsoft.Extensions.Logging.Internal +{ + /// + /// Formatter to convert the named format items like {NamedformatItem} to format. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This type is retained only for compatibility. The recommended alternative is the Microsoft.Extensions.Diagnostics.Testing package.", error: true)] + public class LogValuesFormatter + { + private readonly Microsoft.Extensions.Logging.LogValuesFormatter _inner; + + /// + /// Initializes a new instance of the class. + /// + /// The named format string. + public LogValuesFormatter(string format) + { + _inner = new Microsoft.Extensions.Logging.LogValuesFormatter(format); + } + + /// Gets the original format string. + public string OriginalFormat => _inner.OriginalFormat; + + /// Gets the list of named format parameter names. + public List ValueNames => _inner.ValueNames; + + /// Formats the given values using the format string. + public string Format(object?[]? values) => _inner.Format(values); + + /// Gets the key/value pair for the format item at the specified index. + public KeyValuePair GetValue(object?[] values, int index) => _inner.GetValue(values, index); + + /// Gets an enumerable of key/value pairs for all format items. + public IEnumerable> GetValues(object[] values) => _inner.GetValues(values); + } +} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/NullScopeObsolete.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/NullScopeObsolete.cs new file mode 100644 index 00000000000000..3a40e0d83cab7e --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/NullScopeObsolete.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.ComponentModel; + +namespace Microsoft.Extensions.Logging.Abstractions.Internal +{ + /// + /// An empty scope without any logic. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This type is retained only for compatibility.", error: true)] + public class NullScope : IDisposable + { + /// + /// Returns the shared instance of . + /// + public static NullScope Instance { get; } = new NullScope(); + + private NullScope() + { + } + + /// + public void Dispose() + { + } + } +} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/TypeNameHelperObsolete.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/TypeNameHelperObsolete.cs new file mode 100644 index 00000000000000..5c6fbe7aada6d5 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/TypeNameHelperObsolete.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.ComponentModel; + +namespace Microsoft.Extensions.Logging.Abstractions.Internal +{ + /// + /// Helper to process type names. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This type is retained only for compatibility.", error: true)] + public class TypeNameHelper + { + /// Pretty prints a type name. + public static string GetTypeDisplayName(Type type) + => Microsoft.Extensions.Internal.TypeNameHelper.GetTypeDisplayName(type); + } +}