Skip to content

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.

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

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