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

Refactor: split methods, docs, error handling, smaller methodes and consistency #176

Merged
merged 14 commits into from
Dec 1, 2017

Conversation

304NotModified
Copy link
Member

No description provided.

{
if (validParameterList != null)
if (validParameterList != null && paramPair.Key != NLogLogger.OriginalFormatPropertyName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it is matching the condition just above

Copy link
Member Author

Choose a reason for hiding this comment

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

yes indeed, was also thinking to refactor that

(note I only moved the check)

Copy link
Member Author

Choose a reason for hiding this comment

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

refactored :)

@snakefoot
Copy link
Contributor

Like this better.

if (string.IsNullOrEmpty(paramPair.Key))
      continue;

if (paramPair.Key != NLogLogger.OriginalFormatPropertyName || i == parameterList.Count - 1)
{

@304NotModified
Copy link
Member Author

Like this better.

if (string.IsNullOrEmpty(paramPair.Key))
continue;

if (paramPair.Key != NLogLogger.OriginalFormatPropertyName || i == parameterList.Count - 1)
{

Then we need still the 2nd (duplicate) check ?

@snakefoot
Copy link
Contributor

snakefoot commented Dec 1, 2017

Then we need still the 2nd (duplicate) check ?

Yes you are right. The code validates that that the parameters comes in the expected order. And if not, then allocates the validParameterList.

I guess the code code should be extracted to method called. CreateValidParameterList(). Where the comment for the method is that it expects the parameters to be non-empty and that the last parameter is the original-format-string.

Little confusing that the validation and the creation of the "valid" parameter list is the same method. Guess I was lazy when I wrote the code.

string.Concat("EventId", eventIdSeparator, "Id"),
string.Concat("EventId", eventIdSeparator, "Name"));
_eventIdPropertyNames = eventIdPropertyNames;
_eventIdPropertyNames = CreateEventIdPropertyNames(eventIdSeparator);
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

ow found it :)

@304NotModified 304NotModified changed the title Refactor: split methods Refactor: split methods, docs, error handling, smaller methodes and consistency Dec 1, 2017
@304NotModified 304NotModified merged commit 3636f98 into master Dec 1, 2017
@304NotModified 304NotModified deleted the refactor-code branch December 1, 2017 21:16
@304NotModified 304NotModified added this to the 1.0.0-rtm-rc4 milestone Dec 1, 2017
@304NotModified
Copy link
Member Author

I guess the code code should be extracted to method called. CreateValidParameterList(). Where the comment for the method is that it expects the parameters to be non-empty and that the last parameter is the original-format-string.

Little confusing that the validation and the creation of the "valid" parameter list is the same method. Guess I was lazy when I wrote the code.

@snakefoot could you please create a PR for this? :)

304NotModified added a commit that referenced this pull request Dec 1, 2017
…onsistency (#176)

* Refactor: split methods

* refactor

* refactor

* proper exception handling

* move docs

* NotImplementedException -> NotSupportedException

* refactor duplicate check

* refactor to mulitple methods

* CaptureMessageProperties consistent with CaptureEventId

checks in method, parameter order

* split method

* fix nullref

* merge 2 ifs

* move method

* reorder methods
@snakefoot
Copy link
Contributor

@snakefoot could you please create a PR for this? :)

Created #180 for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants