-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(SocketLogging): add SocketLogging function #556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,18 +1,42 @@ | ||||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|
|
||||||
| <PropertyGroup> | ||||||
| <Version>9.0.4</Version> | ||||||
| <Version>9.0.5</Version> | ||||||
| </PropertyGroup> | ||||||
|
|
||||||
| <PropertyGroup> | ||||||
| <PackageTags>BootstrapBlazor Socket</PackageTags> | ||||||
| <Description>BootstrapBlazor extensions of Socket</Description> | ||||||
| </PropertyGroup> | ||||||
|
|
||||||
| <PropertyGroup> | ||||||
| <NET8Version>8.0.*</NET8Version> | ||||||
| <NET9Version>9.0.*</NET9Version> | ||||||
| </PropertyGroup> | ||||||
|
|
||||||
| <ItemGroup Condition="'$(TargetFramework)' == 'net6.0'"> | ||||||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(NET8Version)" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| <ItemGroup Condition="'$(TargetFramework)' == 'net7.0'"> | ||||||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(NET8Version)" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| <ItemGroup Condition="'$(TargetFramework)' == 'net8.0'"> | ||||||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(NET9Version)" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| <ItemGroup Condition="'$(TargetFramework)' == 'net9.0'"> | ||||||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(NET9Version)" /> | ||||||
|
||||||
| </ItemGroup> | ||||||
|
|
||||||
| <ItemGroup> | ||||||
| </ItemGroup> | ||||||
|
Comment on lines
+33
to
+34
|
||||||
| <ItemGroup> | |
| </ItemGroup> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |||||
|
|
||||||
| using System.Text; | ||||||
|
|
||||||
| namespace BootstrapBlazor.Components.DataConverter; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: Namespace change introduces inconsistency with other files. Please update the namespace to 'BootstrapBlazor.Socket.DataConverters' for consistency with the rest of the codebase and to prevent potential type resolution issues. |
||||||
| namespace BootstrapBlazorSocket.DataConverter; | ||||||
|
||||||
| namespace BootstrapBlazorSocket.DataConverter; | |
| namespace BootstrapBlazor.Socket.DataConverter; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |||||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||||||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||||||
|
|
||||||
| namespace BootstrapBlazor.Components.DataConverter; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Namespace 'BootstrapBlazor.Socket.DataConverter' is singular, while others use plural. Consider renaming the namespace to 'BootstrapBlazor.Socket.DataConverters' to match the convention used elsewhere in the codebase.
Suggested change
|
||||||
| namespace BootstrapBlazor.Socket.DataConverter; | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 十六进制 与 Byte 数组转换方法 | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,44 @@ | ||||||||||||||||||||||||||||||||||||||||||
| // Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||||||||||||||||||||||||||||||||||||||||||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| using Microsoft.Extensions.Logging; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| namespace BootstrapBlazor.Socket.Logging; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||
| /// Socket 日志记录类 | ||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||
| public static class SocketLogging | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| private static ILogger? _logger; | ||||||||||||||||||||||||||||||||||||||||||
| private static bool _inited; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||
| /// 返回 是否已经初始化 | ||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||
| public static bool Inited => _inited; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||
| /// 初始化 ILogger 实例 | ||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||
| /// <param name="logger"></param> | ||||||||||||||||||||||||||||||||||||||||||
| public static void Init(ILogger logger) | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| _inited = true; | ||||||||||||||||||||||||||||||||||||||||||
| _logger = logger; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||
| /// <param name="message"></param> | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+33
to
+35
|
||||||||||||||||||||||||||||||||||||||||||
| /// | |
| /// </summary> | |
| /// <param name="message"></param> | |
| /// Logs an error message using the configured logger. | |
| /// </summary> | |
| /// <param name="message">The error message to log.</param> |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty XML documentation comment should be completed to describe the LogError overload method's purpose and parameters.
| /// | |
| /// </summary> | |
| /// <param name="message"></param> | |
| public static void LogError(string message) => _logger?.LogError(message); | |
| /// <summary> | |
| /// | |
| /// </summary> | |
| /// <param name="ex"></param> | |
| /// <param name="message"></param> | |
| /// Logs an error message using the configured logger. | |
| /// </summary> | |
| /// <param name="message">The error message to log.</param> | |
| public static void LogError(string message) => _logger?.LogError(message); | |
| /// <summary> | |
| /// Logs an exception and an optional error message using the configured logger. | |
| /// </summary> | |
| /// <param name="ex">The exception to log.</param> | |
| /// <param name="message">An optional error message to log with the exception.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .NET 8.0 target framework is incorrectly using NET9Version. Line 26 should use $(NET8Version) to match the pattern established for other .NET 8.0 dependencies.