-
Notifications
You must be signed in to change notification settings - Fork 58
Refactor Drivelution for AOT compatibility, remove Serilog dependency, upgrade to .NET 10, and eliminate all project dependencies #147
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0334d5d
Initial plan
Copilot 18c80ce
Update logger method calls to match IDrivelutionLogger interface sign…
Copilot 4994688
Remove AOT-incompatible attributes from Linux and MacOS implementations
Copilot d19ece4
Remove Serilog and AOT attributes from Drivelution
Copilot 0a809e5
Change from project reference to file linking for Drivelution
Copilot 2e460ea
Update tests to use new DrivelutionLogger interface
Copilot 9ae8985
Fix logger calls to use string interpolation instead of Serilog-style…
Copilot 748c3d4
Upgrade GeneralUpdate.Drivelution to .NET 10 instead of .NET Standard…
Copilot f1d313c
Replace _logger with GeneralTracer in Drivelution implementation files
Copilot 8c44d97
Fix logging level consistency and remove unused exception variables
Copilot 0029025
Add exception messages to warnings for better troubleshooting
Copilot 8b1f43e
Replace logger with GeneralTracer in factory and mark logger paramete…
Copilot 7d4ccb6
Improve obsolete attribute messages with migration guidance
Copilot cfc28c7
Replace IDrivelutionLogger with GeneralTracer for consistent logging
Copilot 06e9425
Replace GeneralUpdate.Common project reference with file linking in D…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/c#/GeneralUpdate.Drivelution/Abstractions/Events/DrivelutionLogger.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| namespace GeneralUpdate.Drivelution.Abstractions.Events; | ||
|
|
||
| /// <summary> | ||
| /// Default implementation of IDrivelutionLogger that raises events | ||
| /// </summary> | ||
| public class DrivelutionLogger : IDrivelutionLogger | ||
| { | ||
| /// <inheritdoc /> | ||
| public event EventHandler<LogEventArgs>? LogMessage; | ||
|
|
||
| /// <inheritdoc /> | ||
| public void Debug(string message, Exception? exception = null, params object[] args) | ||
| { | ||
| RaiseLogEvent(LogLevel.Debug, message, exception, args); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public void Information(string message, Exception? exception = null, params object[] args) | ||
| { | ||
| RaiseLogEvent(LogLevel.Information, message, exception, args); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public void Warning(string message, Exception? exception = null, params object[] args) | ||
| { | ||
| RaiseLogEvent(LogLevel.Warning, message, exception, args); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public void Error(string message, Exception? exception = null, params object[] args) | ||
| { | ||
| RaiseLogEvent(LogLevel.Error, message, exception, args); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public void Fatal(string message, Exception? exception = null, params object[] args) | ||
| { | ||
| RaiseLogEvent(LogLevel.Fatal, message, exception, args); | ||
| } | ||
|
|
||
| private void RaiseLogEvent(LogLevel level, string message, Exception? exception, params object[] args) | ||
| { | ||
| try | ||
| { | ||
| // Format message if args provided | ||
| var formattedMessage = args.Length > 0 ? string.Format(message, args) : message; | ||
|
|
||
| var eventArgs = new LogEventArgs | ||
| { | ||
| Level = level, | ||
| Message = formattedMessage, | ||
| Exception = exception, | ||
| Timestamp = DateTime.UtcNow | ||
| }; | ||
|
|
||
| LogMessage?.Invoke(this, eventArgs); | ||
| } | ||
| catch | ||
| { | ||
| // Silently ignore exceptions in logging to prevent cascading failures | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
IDrivelutionLoggermethods acceptparams object[] args, but the implementation usesstring.Format(message, args), which is incompatible with Serilog-style message templates (e.g.,{DriverName}) and will throwFormatException. Because the catch block swallows all exceptions, logging can silently disappear. Either removeargsand require pre-formatted strings, or implement a formatter compatible with the expected template syntax and avoid swallowing formatting errors silently.