Skip to content
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

feature: Add NLog logging adapter #236

Merged
merged 13 commits into from
Jan 21, 2019
Merged

feature: Add NLog logging adapter #236

merged 13 commits into from
Jan 21, 2019

Conversation

dpvreony
Copy link
Member

@dpvreony dpvreony commented Jan 20, 2019

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Brings Splat.NLog into the main Splat repository

What is the current behavior? (You can also link to an open issue here)

Was being maintained externally

What is the new behavior (if this is a feature change)?

What might this PR break?

The build until the nuget package permissions are transferred. (not changed the build script)

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:

  • Have left the helper method in for setting up NLog as a way to lower developer setup burden.
  • Have targeted the lowest version of NLog supporting netstandard etc. The full .net framework version could support a much lower version, if desired.
  • NLogLogger is using the more lightweight ILogger compared to that from RX-UI5. It's supports the Type appending. But you could also use LogEventInfo property collection for this.
  • I've put a comment in the setter for the Level property as it seems a bit brute force to be editing the nlog config.

@dnfclas
Copy link

dnfclas commented Jan 20, 2019

CLA assistant check
All CLA requirements met.

Copy link
Contributor

@glennawatson glennawatson left a comment

Choose a reason for hiding this comment

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

This looks good, thanks for doing this @dpvreony

_level = value;
foreach (var configurationLoggingRule in _inner.Factory.Configuration.LoggingRules)
{
configurationLoggingRule.SetLoggingLevels(RxUitoNLogLevel(value), global::NLog.LogLevel.Fatal);
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth removing the RxUI reference in this class, just because we in theory trying to make it more "platform' agnostic in the splat package.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

/// <remarks>
/// You should configure NLog prior to calling this method.
/// </remarks>
public static void UseNLogWithWrappingFullLogger()
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth changing this to a extension method, with this IMutableDependencyResolver -- that way you can register it against different containers

Then it becomes

Locator.CurrentMutable.UseNLogWithWrappingFullLogger();

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@glennawatson glennawatson changed the title #232 NLog logging adapter feature: Add NLog logging adapter Jan 20, 2019
@@ -0,0 +1,17 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>net461;uap10.0.16299;MonoAndroid80;Xamarin.iOS10;netstandard2.0</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

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

Only other suggestion I have is adding the platforms from the main Splat project. Not sure if its strictly necessary though since in theory I think .netstandard2.0/uap/net461 will be likely the only ones needed.

@glennawatson glennawatson merged commit d27b0b4 into reactiveui:master Jan 21, 2019
@glennawatson
Copy link
Contributor

Awesome thanks @dpvreony

@lock lock bot locked and limited conversation to collaborators Jun 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants