Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
using System.Collections.Generic;
using System.Threading;

namespace Microsoft.Extensions.Logging.Internal
namespace Microsoft.Extensions.Logging
{
/// <summary>
/// LogValues to enable formatting options supported by <see cref="M:string.Format"/>.
/// This also enables using {NamedformatItem} in the format string.
/// </summary>
public readonly struct FormattedLogValues : IReadOnlyList<KeyValuePair<string, object>>
internal readonly struct FormattedLogValues : IReadOnlyList<KeyValuePair<string, object>>
{
internal const int MaxCachedFormatters = 1024;
private const string NullFormat = "[null]";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;

namespace Microsoft.Extensions.Logging
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
using System.Globalization;
using System.Text;

namespace Microsoft.Extensions.Logging.Internal
namespace Microsoft.Extensions.Logging
{
/// <summary>
/// Formatter to convert the named format items like {NamedformatItem} to <see cref="M:string.Format"/> format.
/// </summary>
public class LogValuesFormatter
internal class LogValuesFormatter
{
private const string NullValue = "(null)";
private static readonly object[] EmptyArray = new object[0];
Expand All @@ -34,16 +34,16 @@ public LogValuesFormatter(string format)
var openBraceIndex = FindBraceIndex(format, '{', scanIndex, endIndex);
var closeBraceIndex = FindBraceIndex(format, '}', openBraceIndex, endIndex);

// Format item syntax : { index[,alignment][ :formatString] }.
var formatDelimiterIndex = FindIndexOfAny(format, FormatDelimiters, openBraceIndex, closeBraceIndex);

if (closeBraceIndex == endIndex)
{
sb.Append(format, scanIndex, endIndex - scanIndex);
scanIndex = endIndex;
}
else
{
// Format item syntax : { index[,alignment][ :formatString] }.
var formatDelimiterIndex = FindIndexOfAny(format, FormatDelimiters, openBraceIndex, closeBraceIndex);

sb.Append(format, scanIndex, openBraceIndex - scanIndex + 1);
sb.Append(_valueNames.Count.ToString(CultureInfo.InvariantCulture));
_valueNames.Add(format.Substring(openBraceIndex + 1, formatDelimiterIndex - openBraceIndex - 1));
Expand Down
3 changes: 0 additions & 3 deletions src/Logging/Logging.Abstractions/src/LoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Globalization;
using Microsoft.Extensions.Logging.Internal;

namespace Microsoft.Extensions.Logging
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.Extensions.Logging;

namespace Microsoft.Extensions.Logging
{
Expand Down Expand Up @@ -73,4 +69,4 @@ public void Dispose()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.Extensions.Logging.Abstractions.Internal;

namespace Microsoft.Extensions.Logging
{
Expand Down Expand Up @@ -44,4 +43,4 @@ public static ILogger CreateLogger(this ILoggerFactory factory, Type type)
return factory.CreateLogger(TypeNameHelper.GetTypeDisplayName(type));
}
}
}
}
3 changes: 1 addition & 2 deletions src/Logging/Logging.Abstractions/src/LoggerMessage.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Internal;

namespace Microsoft.Extensions.Logging
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.Extensions.Logging.Abstractions.Internal;

namespace Microsoft.Extensions.Logging
{
Expand Down Expand Up @@ -44,4 +43,4 @@ void ILogger.Log<TState>(LogLevel logLevel, EventId eventId, TState state, Excep
_logger.Log(logLevel, eventId, state, exception, formatter);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using System.Collections.Generic;
using System.Reflection;

namespace Microsoft.Extensions.Logging.Abstractions.Internal
namespace Microsoft.Extensions.Logging
{
public class TypeNameHelper
internal class TypeNameHelper
{
private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
{
Expand Down Expand Up @@ -78,4 +78,4 @@ public static string GetTypeDisplayName(Type type)
}
}
}
}
}
1 change: 0 additions & 1 deletion src/Logging/Logging.Analyzers/src/LogFormatAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.Extensions.Logging.Internal;

namespace Microsoft.Extensions.Logging.Analyzers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<Compile Include="..\..\Logging.Abstractions\src\Internal\LogValuesFormatter.cs" />
<Compile Include="..\..\Logging.Abstractions\src\LogValuesFormatter.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Analyzer.Testing;
using Microsoft.CodeAnalysis;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.Extensions.Configuration;

namespace Microsoft.Extensions.Logging.Configuration
Expand Down Expand Up @@ -41,4 +40,4 @@ public IConfiguration GetConfiguration(Type providerType)
return configurationBuilder.Build();
}
}
}
}
1 change: 0 additions & 1 deletion src/Logging/Logging.Console/src/ConsoleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Text;
using Microsoft.Extensions.Logging.Abstractions.Internal;

namespace Microsoft.Extensions.Logging.Console
{
Expand Down
1 change: 0 additions & 1 deletion src/Logging/Logging.Console/src/ConsoleLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Concurrent;
using System.Runtime.InteropServices;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;

namespace Microsoft.Extensions.Logging.Console
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging.Debug;
Expand Down
4 changes: 1 addition & 3 deletions src/Logging/Logging.Testing/src/RetryContext.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;

namespace Microsoft.Extensions.Logging.Testing
{
public class RetryContext
Expand All @@ -15,4 +13,4 @@ public class RetryContext

internal int CurrentIteration { get; set; }
}
}
}
4 changes: 1 addition & 3 deletions src/Logging/Logging.Testing/src/TestLoggerFactory.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;

namespace Microsoft.Extensions.Logging.Testing
{
public class TestLoggerFactory : ILoggerFactory
Expand All @@ -29,4 +27,4 @@ public void Dispose()
{
}
}
}
}
3 changes: 1 addition & 2 deletions src/Logging/Logging.Testing/src/Xunit/LoggedTestRunner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand All @@ -9,7 +9,6 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit.Abstractions;
using Xunit.Sdk;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Text.RegularExpressions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Test;
using Xunit;

Expand Down
3 changes: 1 addition & 2 deletions src/Logging/Logging/src/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging.Abstractions.Internal;

namespace Microsoft.Extensions.Logging
{
Expand Down Expand Up @@ -195,4 +194,4 @@ public void Dispose()
}
}
}
}
}
3 changes: 1 addition & 2 deletions src/Logging/Logging/src/LoggerFactory.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.Extensions.Options;

namespace Microsoft.Extensions.Logging
Expand Down
3 changes: 1 addition & 2 deletions src/Logging/test/Console/ConsoleSink.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;

namespace Microsoft.Extensions.Logging.Test.Console
Expand All @@ -15,4 +14,4 @@ public void Write(ConsoleContext context)
Writes.Add(context);
}
}
}
}
1 change: 0 additions & 1 deletion src/Logging/test/DebugLoggerTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.Extensions.Logging.Debug;
using Microsoft.Extensions.Logging.Test;
using Xunit;

Expand Down
1 change: 0 additions & 1 deletion src/Logging/test/FormattedLogValuesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Linq;
using Microsoft.Extensions.Logging.Internal;
using Xunit;

namespace Microsoft.Extensions.Logging.Test
Expand Down
1 change: 0 additions & 1 deletion src/Logging/test/LoggerExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging.Internal;
using Microsoft.Extensions.Logging.Testing;
using Xunit;

Expand Down
1 change: 0 additions & 1 deletion src/Logging/test/LoggerFactoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Text;
using Moq;
using Xunit;

Expand Down
1 change: 0 additions & 1 deletion src/Logging/test/TraceSourceLoggerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

namespace Microsoft.Extensions.Logging.Test
Expand Down
1 change: 0 additions & 1 deletion src/Logging/test/TraceSourceScopeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

namespace Microsoft.Extensions.Logging.Test
Expand Down
5 changes: 0 additions & 5 deletions src/Shared/src/BenchmarkRunner/DefaultCoreValidationConfig.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using System.Reflection;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Loggers;
Expand Down