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

Registering Layout renderers with func (one line needed), easier registering layout/layoutrender/targets #1581

Merged
merged 1 commit into from
Nov 21, 2016

Conversation

304NotModified
Copy link
Member

@304NotModified 304NotModified commented Aug 4, 2016

Easier adding of Layout renderers.

Just need one line :)

Example

//register ${text-fixed}
LayoutRenderer.Register("test-fixed", (info) => "2");

//test
Layout l = "${test-fixed}";
var result = l.Render(LogEventInfo.CreateNullEvent());
Assert.Equal("2", result);

Not sure about the name and API

real-life example

//register ${trace-identifier}
LayoutRenderer.Register("trace-identifier", (info) =>  HttpContext.Current.TraceIdentifier );

Using logEventInfo

LayoutRenderer.Register("message-length", (info) => info.Message.Length);
  • rename AdhocLayoutRenderer to FuncLayoutRenderer and update methods

This change is Reviewable

@304NotModified 304NotModified force-pushed the adhoc-layoutrenderers branch 4 times, most recently from d8015c0 to 6a9eb97 Compare August 4, 2016 22:28
@codecov-io
Copy link

codecov-io commented Aug 4, 2016

Current coverage is 76% (diff: 91%)

Sunburst

No coverage report found for master at 00e58af.

Powered by Codecov. Last update 00e58af...4b96796

- helpers for registing custom target/layout/layoutrenderer
@304NotModified 304NotModified changed the title [WIP] Adhoc layoutrenderers Registering Layout renderers with func (one line needed), easier registering layout/layoutrender/targets Nov 21, 2016
@304NotModified 304NotModified merged commit f900e35 into master Nov 21, 2016
@304NotModified 304NotModified deleted the adhoc-layoutrenderers branch November 21, 2016 23:19
@304NotModified
Copy link
Member Author

@304NotModified 304NotModified added the documentation done all docs done (wiki, api docs, lists on nlog-project.org, xmldocs) label Dec 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation done all docs done (wiki, api docs, lists on nlog-project.org, xmldocs) feature needs documentation on wiki
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants