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
2 changes: 0 additions & 2 deletions src/NReco.Logging.File/FileLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#endregion

using System;
using System.Buffers;
using System.Text;
using Microsoft.Extensions.Logging;

namespace NReco.Logging.File {
Expand All @@ -27,19 +25,19 @@
private readonly string logName;
private readonly FileLoggerProvider LoggerPrv;

public FileLogger(string logName, FileLoggerProvider loggerPrv) {

Check warning on line 28 in src/NReco.Logging.File/FileLogger.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLogger.FileLogger(string, FileLoggerProvider)'
this.logName = logName;
this.LoggerPrv = loggerPrv;
}
public IDisposable BeginScope<TState>(TState state) {

Check warning on line 32 in src/NReco.Logging.File/FileLogger.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLogger.BeginScope<TState>(TState)'
return null;
}

public bool IsEnabled(LogLevel logLevel) {

Check warning on line 36 in src/NReco.Logging.File/FileLogger.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLogger.IsEnabled(LogLevel)'
return logLevel>=LoggerPrv.MinLevel;
}

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state,

Check warning on line 40 in src/NReco.Logging.File/FileLogger.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLogger.Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, string>)'
Exception exception, Func<TState, Exception, string> formatter) {
if (!IsEnabled(logLevel)) {
return;
Expand Down
9 changes: 0 additions & 9 deletions src/NReco.Logging.File/FileLoggerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,7 @@
*/
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Concurrent;
using System.Text;

using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;

namespace NReco.Logging.File {

Expand Down
7 changes: 1 addition & 6 deletions src/NReco.Logging.File/FileLoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,13 @@
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

using NReco.Logging.File;
using Microsoft.Extensions.Logging;

namespace NReco.Logging.File {

public static class FileLoggerExtensions {

Check warning on line 22 in src/NReco.Logging.File/FileLoggerExtensions.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerExtensions'

/// <summary>
/// Adds a file logger.
Expand Down
8 changes: 0 additions & 8 deletions src/NReco.Logging.File/FileLoggerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Concurrent;
using System.Text;

using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;

namespace NReco.Logging.File {

Expand Down
8 changes: 2 additions & 6 deletions src/NReco.Logging.File/FileLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@
#endregion

using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Concurrent;
using System.Text;

using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;

namespace NReco.Logging.File {

Expand All @@ -45,7 +41,7 @@
private long FileSizeLimitBytes => Options.FileSizeLimitBytes;
private int MaxRollingFiles => Options.MaxRollingFiles;

public LogLevel MinLevel {

Check warning on line 44 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.MinLevel'
get => Options.MinLevel;
set { Options.MinLevel = value; }
}
Expand Down Expand Up @@ -82,13 +78,13 @@
set { Options.HandleFileError = value; }
}

public FileLoggerProvider(string fileName) : this(fileName, true) {

Check warning on line 81 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.FileLoggerProvider(string)'
}

public FileLoggerProvider(string fileName, bool append) : this(fileName, new FileLoggerOptions() { Append = append }) {

Check warning on line 84 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.FileLoggerProvider(string, bool)'
}

public FileLoggerProvider(string fileName, FileLoggerOptions options) {

Check warning on line 87 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.FileLoggerProvider(string, FileLoggerOptions)'
Options = options;
LogFileName = Environment.ExpandEnvironmentVariables(fileName);

Expand All @@ -99,7 +95,7 @@
TaskCreationOptions.LongRunning);
}

public ILogger CreateLogger(string categoryName) {

Check warning on line 98 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.CreateLogger(string)'
return loggers.GetOrAdd(categoryName, CreateLoggerImplementation);
}

Expand Down
5 changes: 2 additions & 3 deletions src/NReco.Logging.File/Format/StringLogEntryFormatter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using Microsoft.Extensions.Logging;
using System;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using Microsoft.Extensions.Logging;

[assembly: InternalsVisibleTo("NReco.Logging.Tests")]

Expand Down
12 changes: 9 additions & 3 deletions src/NReco.Logging.File/NReco.Logging.File.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Lightweight file logging provider implementation for NET6 / NET8+ / .NET Core without dependencies on logging frameworks.
<Description>Lightweight file logging provider implementation for NET6 / NET8 / NET10+ .NET Core without dependencies on logging frameworks.

How to use:

Expand All @@ -13,12 +13,12 @@ services.AddLogging(loggingBuilder =&gt; {

More details and examples: https://github.com/nreco/logging
</Description>
<Title>NET8/ NET6 / .NET Core file logger provider.</Title>
<Title>NET10 / NET8 / NET6 / .NET Core file logger provider.</Title>
<Copyright>Copyright (c) 2017-2024 Vitalii Fedorchenko and contributors</Copyright>
<AssemblyTitle>NReco.Logging.File</AssemblyTitle>
<VersionPrefix>1.2.2</VersionPrefix>
<Authors>Vitalii Fedorchenko and contributors</Authors>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0;net10.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>NReco.Logging.File</AssemblyName>
Expand Down Expand Up @@ -105,4 +105,10 @@ Version 1.0.4 changes:
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.*" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="10.0.*" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.*" />
</ItemGroup>

</Project>
11 changes: 7 additions & 4 deletions test/NReco.Logging.Tests/NReco.Logging.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net481</TargetFrameworks>
<TargetFrameworks>net8.0;net10.0;net481</TargetFrameworks>
<AssemblyName>NReco.Logging.Tests</AssemblyName>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -11,9 +11,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.9.3" />
</ItemGroup>

</Project>
Loading