Skip to content

chore(Logging): bump version 10.0.0#36

Merged
ArgoZhang merged 8 commits into
mainfrom
feat-log
Nov 15, 2025
Merged

chore(Logging): bump version 10.0.0#36
ArgoZhang merged 8 commits into
mainfrom
feat-log

Conversation

@ArgoZhang

Copy link
Copy Markdown
Member

Link issues

fixes #35

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Copilot AI review requested due to automatic review settings November 15, 2025 05:25
@ArgoZhang ArgoZhang merged commit 28c6ade into main Nov 15, 2025
3 checks passed
@ArgoZhang ArgoZhang deleted the feat-log branch November 15, 2025 05:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces version 10.0.0 of the Longbow.Logging component, adding comprehensive logging functionality with support for file-based and database logging. The PR upgrades multiple Microsoft.Extensions package dependencies to version 10.* and targets .NET 10.0, which may not be stable or available yet.

Key Changes:

  • Added complete Longbow.Logging library with FileLogger and DBLogger implementations
  • Updated test project dependencies from version 9.* to 10.* for Microsoft.Extensions packages
  • Added comprehensive unit tests for the new logging functionality

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 27 comments.

Show a summary per file
File Description
test/UnitTestTcpSocket/UnitTestTcpSocket.csproj Updated Microsoft.Extensions.DependencyInjection to version 10.*
test/UnitTestSocket/UnitTestSocket.csproj Updated Microsoft.Extensions.Options.ConfigurationExtensions to version 10.*
test/UnitTestModbus/UnitTestModbus.csproj Updated Microsoft.Extensions.DependencyInjection to version 10.*
test/UnitTestLogging/appsettings.json Added configuration for file logger with batch and scope settings
test/UnitTestLogging/UnitTestLogging.csproj New test project targeting net10.0 with version 10.* dependencies
test/UnitTestLogging/TestHelper.cs Helper class for triggering configuration file change events
test/UnitTestLogging/LoggerProviderTest.cs Tests for LoggerProvider creation and disposal
test/UnitTestLogging/FileLoggerWriterTest.cs Tests for file logger writer including batch processing and file rolling
test/UnitTestLogging/FileLoggerTest.cs Tests for file logger integration with DI container (contains syntax error)
test/UnitTestLogging/DBLoggerTest.cs Tests for database logger provider and IP address extensions
test/Directory.Build.props Updated Microsoft.NET.Test.Sdk to version 18.*
src/Longbow.Logging/readme.zh-CN.md Chinese documentation for the logging library
src/Longbow.Logging/readme.md English documentation for the logging library
src/Longbow.Logging/exceptionManagement.json Example configuration for exception logging
src/Longbow.Logging/Longbow.Logging.csproj Project file with multi-targeting support and version 10.* package references
src/Longbow.Logging/LoggerProviderConfigureOptions.cs Configuration helper for logger providers
src/Longbow.Logging/Logger/LoggerProvider.cs Base logger provider implementation
src/Longbow.Logging/Logger/LoggerBase.cs Abstract base class for logger implementations
src/Longbow.Logging/Logger/Logger.cs Console logger implementation
src/Longbow.Logging/LogMessage.cs Log message data structure
src/Longbow.Logging/FormatExceptionExtensions.cs Exception formatting utilities for detailed error output
src/Longbow.Logging/FileLogger/FileLoggerWriter.cs File writing logic with batch processing support
src/Longbow.Logging/FileLogger/FileLoggerProvider.cs File logger provider with configuration monitoring
src/Longbow.Logging/FileLogger/FileLoggerOptions.cs Configuration options for file logging
src/Longbow.Logging/FileLogger/FileLogger.cs File logger implementation
src/Longbow.Logging/Extensions/FileLoggerFactoryExtensions.cs DI registration extensions for file and database loggers
src/Longbow.Logging/DBLogger/DBLoggerProvider.cs Database logger provider implementation
src/Longbow.Logging/DBLogger/DBLogger.cs Database logger implementation (contains signature error)
src/Longbow.Logging/ConfigurationExtensions.cs Configuration extensions for environment variables (contains typo)
Longbow.Utility2026.slnx Added Longbow.Logging project to solution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +14
/// <typeparam name="TOptions"></typeparam>
/// <typeparam name="TProvider"></typeparam>

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty XML comment lacks a description. Consider adding a meaningful summary that explains the purpose of the LoggerProviderConfigureOptions class.

Suggested change
/// <typeparam name="TOptions"></typeparam>
/// <typeparam name="TProvider"></typeparam>
/// <typeparam name="TOptions">The options type to be configured for the logger provider.</typeparam>
/// <typeparam name="TProvider">The logger provider type for which the options are being configured.</typeparam>

Copilot uses AI. Check for mistakes.
public abstract class LoggerBase(string name, Func<string, LogLevel, bool>? filter, IExternalScopeProvider? scopeProvider, IConfiguration? config) : ILogger
{
/// <summary>
///

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty XML comment lacks a description. Consider adding a meaningful summary that explains the purpose of the LogName property.

Suggested change
///
/// Gets the name of the logger instance.

Copilot uses AI. Check for mistakes.
protected string LogName { get; } = name;

/// <summary>
///

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty XML comment lacks a description. Consider adding a meaningful summary that explains the purpose of the Filter property.

Suggested change
///
/// Gets the filter function used to determine whether logging is enabled for a given category and log level.

Copilot uses AI. Check for mistakes.
public static class ConfigurationExtensions
{
/// <summary>
/// 获得 环境变量中的 OS 属性值 近 Windows 平台有效

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "近 Windows 平台有效" should be "仅 Windows 平台有效" (only valid for Windows platform).

Suggested change
/// 获得 环境变量中的 OS 属性值 Windows 平台有效
/// 获得 环境变量中的 OS 属性值 Windows 平台有效

Copilot uses AI. Check for mistakes.
public static class TestHelper
{
/// <summary>
///

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty XML comment lacks a description. Consider adding a meaningful summary that explains the purpose of the TestHelper class.

Suggested change
///
/// Triggers a reload of the app settings file and invokes the specified callback when the configuration changes.

Copilot uses AI. Check for mistakes.

// 生成过期文件
var file = CreateOldLogFile(fileName);
var folder = file.Folder;

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment to folder is useless, since its value is never read.

Suggested change
var folder = file.Folder;

Copilot uses AI. Check for mistakes.

// 生产长度不满足内部判断条件的干扰文件
var fn = $"Log01.log";
using (var fs = File.AppendText(Path.Combine(folder, fn))) { }

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment to fs is useless, since its value is never read.

Suggested change
using (var fs = File.AppendText(Path.Combine(folder, fn))) { }
File.AppendText(Path.Combine(folder, fn)).Dispose();

Copilot uses AI. Check for mistakes.

//
await Task.Delay(2000);
var foo = DateTime.Now;

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment to foo is useless, since its value is never read.

Suggested change
var foo = DateTime.Now;

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +107
if (propertyValue != null)
{
#region Loop through the public properties of the exception object and record their value
// Loop through the public properties of the exception object and record their value.
// Cast the collection into a local variable.
// Check if the collection contains values.
if (propertyValue is NameValueCollection currentAdditionalInfo && currentAdditionalInfo.Count > 0)
{
strInfo.AppendFormat("AdditionalInformation{0}", Environment.NewLine);
// Loop through the collection adding the information to the string builder.
foreach (string? infoKey in currentAdditionalInfo)
{
if (!string.IsNullOrEmpty(infoKey)) strInfo.AppendFormat("{1}: {2}{0}", Environment.NewLine, infoKey, currentAdditionalInfo[infoKey]);
}

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 'if' statements can be combined.

Suggested change
if (propertyValue != null)
{
#region Loop through the public properties of the exception object and record their value
// Loop through the public properties of the exception object and record their value.
// Cast the collection into a local variable.
// Check if the collection contains values.
if (propertyValue is NameValueCollection currentAdditionalInfo && currentAdditionalInfo.Count > 0)
{
strInfo.AppendFormat("AdditionalInformation{0}", Environment.NewLine);
// Loop through the collection adding the information to the string builder.
foreach (string? infoKey in currentAdditionalInfo)
{
if (!string.IsNullOrEmpty(infoKey)) strInfo.AppendFormat("{1}: {2}{0}", Environment.NewLine, infoKey, currentAdditionalInfo[infoKey]);
}
if (propertyValue is NameValueCollection currentAdditionalInfo && currentAdditionalInfo.Count > 0)
{
#region Loop through the public properties of the exception object and record their value
// Loop through the public properties of the exception object and record their value.
// Cast the collection into a local variable.
// Check if the collection contains values.
strInfo.AppendFormat("AdditionalInformation{0}", Environment.NewLine);
// Loop through the collection adding the information to the string builder.
foreach (string? infoKey in currentAdditionalInfo)
{
if (!string.IsNullOrEmpty(infoKey)) strInfo.AppendFormat("{1}: {2}{0}", Environment.NewLine, infoKey, currentAdditionalInfo[infoKey]);

Copilot uses AI. Check for mistakes.
Comment on lines +193 to +205
if (disposing)
{
if (!disposedValue)
{
disposedValue = true;

_messageQueue.CompleteAdding();
_cancellationTokenSource.Cancel();
_logTask.Wait(Option.TaskWaitTime);

_cancellationTokenSource.Dispose();
_messageQueue.Dispose();
}

Copilot AI Nov 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 'if' statements can be combined.

Suggested change
if (disposing)
{
if (!disposedValue)
{
disposedValue = true;
_messageQueue.CompleteAdding();
_cancellationTokenSource.Cancel();
_logTask.Wait(Option.TaskWaitTime);
_cancellationTokenSource.Dispose();
_messageQueue.Dispose();
}
if (disposing && !disposedValue)
{
disposedValue = true;
_messageQueue.CompleteAdding();
_cancellationTokenSource.Cancel();
_logTask.Wait(Option.TaskWaitTime);
_cancellationTokenSource.Dispose();
_messageQueue.Dispose();

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(Logging): bump version 10.0.0

2 participants