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

add final param to AddRule Methods #2612

Merged
merged 4 commits into from
Mar 7, 2018
Merged

add final param to AddRule Methods #2612

merged 4 commits into from
Mar 7, 2018

Conversation

893949088
Copy link
Contributor

add final param by AddRule Method

Add Params ( final ) By AddRule Method
add final param by addrule method
@snakefoot
Copy link
Contributor

This is a breaking change. You have to make new methods, instead of adding parameter to existing ones.

@893949088
Copy link
Contributor Author

@snakefoot I don‘t want to configure nlog by xml file.I want configure nlog by LoggingConfiguration.but the AddRule method don't has 'final' param. why this is a breaking change?

@snakefoot
Copy link
Contributor

snakefoot commented Mar 3, 2018

why this is a breaking change?

Your code-change requires a complete recompile of all source-code using NLog, or else they will get a MissingMethodException:

Ex. This method is suddenly gone:

public void AddRuleForOneLevel(LogLevel level, Target target, string loggerNamePattern)

Instead there is this method, but it has a different signature:

public void AddRuleForOneLevel(LogLevel level, Target target, string loggerNamePattern, bool final = false)

@893949088
Copy link
Contributor Author

@snakefoot So, Should I open a new issue??

@snakefoot
Copy link
Contributor

snakefoot commented Mar 4, 2018

@893949088 You can just add more commits to the same PR. They will usually be squashed into a single commit before merge.

@893949088
Copy link
Contributor Author

893949088 commented Mar 4, 2018

@snakefoot But I don't have more change to commit. I really want this ’final‘ function。
╯﹏╰ !!

@snakefoot
Copy link
Contributor

snakefoot commented Mar 4, 2018

@893949088 If you want this included within the next year, then you need to fix the breaking change. Else it will be postponed until like forever.

@893949088
Copy link
Contributor Author

@snakefoot I'm very sad. why is the 'LoggingConfiguration' imperfect?

@snakefoot
Copy link
Contributor

why is the 'LoggingConfiguration' imperfect?

Because of the breaking change you have introduced, by changing the signature of the existing methods.

@893949088
Copy link
Contributor Author

@snakefoot How can I do it to fix the breaking change?I haven't submit PR before.
^_^"

@snakefoot
Copy link
Contributor

snakefoot commented Mar 4, 2018

@893949088 The breaking change is that you have modified the signature of the existing methods. The very simple solution is not to modify the signature of the existing methods.

So just add the new methods without default parameters, and make the existing methods call the new method:

public void AddRuleForOneLevel(LogLevel level, Target target, string loggerNamePattern = "*")
{
   // Existing method forwarding to new method
   AddRuleForOneLevel(level, target, loggerNamePattern, false);
}

public void AddRuleForOneLevel(LogLevel level, Target target, string loggerNamePattern, bool final)
{
   // Do the right thing
}

@893949088
Copy link
Contributor Author

@snakefoot Thank you very much!!!

Add AddRule Method (final param)
@codecov
Copy link

codecov bot commented Mar 5, 2018

Codecov Report

Merging #2612 into master will increase coverage by <1%.
The diff coverage is 83%.

@@           Coverage Diff           @@
##           master   #2612    +/-   ##
=======================================
+ Coverage      81%     81%   +<1%     
=======================================
  Files         325     325            
  Lines       23938   23950    +12     
  Branches     3025    3028     +3     
=======================================
+ Hits        19416   19427    +11     
- Misses       3704    3708     +4     
+ Partials      818     815     -3

@893949088 893949088 closed this Mar 5, 2018
@893949088 893949088 reopened this Mar 5, 2018
@893949088
Copy link
Contributor Author

〒_〒!〒_〒!〒_〒!

@snakefoot
Copy link
Contributor

@893949088 Remember to remove the parameter default values for the new methods.

@304NotModified 304NotModified changed the title Update LoggingConfiguration.cs add final param to AddRule Methods Mar 5, 2018
@304NotModified 304NotModified added feature enhancement Improvement on existing feature nlog-configuration labels Mar 5, 2018
@304NotModified 304NotModified self-assigned this Mar 5, 2018
@304NotModified 304NotModified added this to the 4.5 rc7 milestone Mar 7, 2018
@304NotModified 304NotModified self-requested a review March 7, 2018 17:12
@304NotModified
Copy link
Member

looks good, thanks!

Will merge this when Travis gives green (restarted Travis, it was stuck)

@304NotModified 304NotModified merged commit d6b2c7f into NLog:master Mar 7, 2018
@snakefoot snakefoot mentioned this pull request Mar 15, 2018
@snakefoot snakefoot modified the milestones: 4.5 rc7, 4.5 Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement on existing feature feature nlog-configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants