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

Replace NewLines Layout Renderer Wrapper #800

Merged
merged 7 commits into from
Jul 23, 2015
Merged

Replace NewLines Layout Renderer Wrapper #800

merged 7 commits into from
Jul 23, 2015

Conversation

jamesuk189
Copy link
Contributor

Added a layout renderer wrapper to replace newline characters with spaces as per issue #86

@304NotModified
Copy link
Member

Thanks!

It seems that to unused using are used?

What's the benefit of the config property?

@jamesuk189
Copy link
Contributor Author

I thought I had removed the unused usings and that property. It is redundant, I added it before I realised initially.

Removed redundant property.
@304NotModified
Copy link
Member

OK. You need to copy the file header of another file to it to fix the failing unit test.

@304NotModified
Copy link
Member

I looks nice! short and clean 👍

Maybe we could also make it configurable how to replace the newline? Because I was expecting "" (no chars), but a space is also an option. I propose to add the property: public string replacement. The default for space is then fine.

What do you think?

@jamesuk189
Copy link
Contributor Author

I like the idea. I was thinking it needed an option to control the separation character/string. I figured having no separator would make it hard to read.

@304NotModified
Copy link
Member

hint: the [DefaultValue] is only a marker and won't set the value. (it's a common mistake and therefor I have created an unit test for it.)

Scratch that.

Can you use an auto property and init the properties in the constructor? That's preferred and more consistent with other code in NLog. Thanks!

@304NotModified
Copy link
Member

You can ignore the failing unit test. That one is failing really sometimes (so there is really something wrong but not in this code)

@jamesuk189
Copy link
Contributor Author

Sorry, I really should have checked how the other properties had been implemented.

@304NotModified
Copy link
Member

No problem. It's just a matter of style.

@304NotModified
Copy link
Member

We will include this in 4.1 :)

One last thing: can you document this on the wiki? (new page)

Maybe also reference from https://github.com/NLog/NLog/wiki/Replace-Layout-Renderer

@jamesuk189
Copy link
Contributor Author

Added a documentation page to the wiki here: https://github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer

@304NotModified
Copy link
Member

OK thanks,

I added also your examples and a 4.1 notice.

But I missed something. How does the test ReplaceNewLineOneLineTest work? And can't we replace with empty string now? It seems that ReplaceNewLineOneLineTest is wrong.

@jamesuk189
Copy link
Contributor Author

The ReplaceNewLineOneLineTest was added for a check that it wasn't applying when it wasn't meant to.

The default could be replaced with an empty string. My preference is to have a space to help keep it a little bit more readable by default.

@304NotModified
Copy link
Member

The default of space is good.

But replace with a empty value is a corner case. We need an unit test for that. Can you add this unit test?

@304NotModified
Copy link
Member

Thanks! It has been merged :)

304NotModified added a commit that referenced this pull request Jul 23, 2015
Replace NewLines Layout Renderer Wrapper
@304NotModified 304NotModified merged commit a8b8414 into NLog:master Jul 23, 2015
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.

None yet

2 participants