Skip to content

Implement Microsoft.Extensions.Logger Wrapper #263

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bagusnl
Copy link

@bagusnl bagusnl commented Nov 27, 2024

Goal: Implement a wrapper for Microsoft's ILogger implementation

This is to make it easier for other project to start implementing this project as Microsoft's ILogger implementation is a standard. This PR is based on our project's implementation but modified to fit in the base repo TargetFrameworks

Unfortunately, I don't seem to able to implement it for net45 TargetFramework for some reason, so it's currently disabled with constants at the moment for that framework. A hand on that would be greatly appreciated.

Only works for netstandard2.0 at the moment
Copy link
Owner

@Lachee Lachee left a comment

Choose a reason for hiding this comment

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

Need some changes. Overall a good idea to implement that standard interface.

@@ -7,6 +7,10 @@
using DiscordRPC.RPC;
using DiscordRPC.RPC.Commands;
using System;
#if !DISABLE_MSLOGGEREXTENSION
using Hi3Helper.SharpDiscordRPC.DiscordRPC.Logging;
Copy link
Owner

Choose a reason for hiding this comment

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

required change: Use the same namespace from the project

@@ -7,6 +7,10 @@
using DiscordRPC.RPC;
using DiscordRPC.RPC.Commands;
using System;
#if !DISABLE_MSLOGGEREXTENSION
using Hi3Helper.SharpDiscordRPC.DiscordRPC.Logging;
using ILoggerMs = Microsoft.Extensions.Logging.ILogger;
Copy link
Owner

Choose a reason for hiding this comment

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

required change: Use fully qualified naming instead of aliases for ambiguities.

/// <summary>
/// Wraps a <see cref="ILogger"/> to a <see cref="ILoggerRpc"/>
/// </summary>
public class MsILoggerWrapper : ILoggerRpc
Copy link
Owner

Choose a reason for hiding this comment

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

nit-pick: Rename to MsLogger

Comment on lines +4 to +6
using ILogger = Microsoft.Extensions.Logging.ILogger;
using ILoggerRpc = DiscordRPC.Logging.ILogger;
using LogLevel = DiscordRPC.Logging.LogLevel;
Copy link
Owner

Choose a reason for hiding this comment

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

required change: Use fully qualified naming instead of aliases for ambiguities.

using ILoggerRpc = DiscordRPC.Logging.ILogger;
using LogLevel = DiscordRPC.Logging.LogLevel;

namespace Hi3Helper.SharpDiscordRPC.DiscordRPC.Logging
Copy link
Owner

Choose a reason for hiding this comment

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

required change: must be the same namespace as the rest of the project.

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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy