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

Log all the form variables #194

Closed
gelambert opened this issue Oct 11, 2017 · 10 comments
Closed

Log all the form variables #194

gelambert opened this issue Oct 11, 2017 · 10 comments

Comments

@gelambert
Copy link

Hi,

Is it possible to log all the form variables without specifying each variable in the layout ?
For example, by using something like ${aspnet-request:form=*} ?
I did not find the way to do it on this page of the wiki.
Thanks for your help.

@304NotModified
Copy link
Member

Currently this isn't possible. I think it's not that difficult to implement. Could you help us with that when I point you to the right direction?

@gelambert
Copy link
Author

For sure, I need this feature so I can help !

@304NotModified
Copy link
Member

You need to create a new file in

  • NLog.Web.AspNetCore/LayoutRenderers
    and link it in NLog.Web
    image

image

I think the code looks a bit like this one:

https://github.com/NLog/NLog.Web/blob/master/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs

please try to add also some unit tests

@gelambert
Copy link
Author

Thank you for your answer.
I should have specified that, but I am using ASP.NET MVC 5.2.3.
If I write some code in NLog.Web.AspNetCore/LayoutRenderers, will I be able to use it in an ASP.NET MVC project ?

@304NotModified
Copy link
Member

well we like to implement it for both. I think the differences will be small. You can use #if ASP_NET_CORE for that. (see example)

When implementing for both, please include it in the NLog.Web.AspNetCore folder (as described)

If it's not feasible for ASP.NET Core, let me know, then we can look how to include this.

@DrewBrasher
Copy link
Contributor

I have implemented this on a fork of NLog.Web. I still need to write unit tests for it but the renderer is here:
https://github.com/DrewBrasher/NLog.Web/blob/add-aspnet-request-form-layout-renderer/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestFormLayoutRenderer.cs

@304NotModified
Copy link
Member

If the unit test is there, we really like to include it :)

@DrewBrasher
Copy link
Contributor

@304NotModified I have added the unit tests and created a pull request.

@304NotModified
Copy link
Member

Thanks! Reviewed!

@304NotModified
Copy link
Member

fixed by #313 :)

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

No branches or pull requests

3 participants