Skip to content

Implement IRawValue on ${whenEmpty}#3395

Closed
304NotModified wants to merge 1 commit intorelease/4.6.4from
whenempty-irawvalue
Closed

Implement IRawValue on ${whenEmpty}#3395
304NotModified wants to merge 1 commit intorelease/4.6.4from
whenempty-irawvalue

Conversation

@304NotModified
Copy link
Copy Markdown
Member

@304NotModified 304NotModified commented May 12, 2019

fixes #3372

related: #3373 and #3139

@304NotModified 304NotModified added this to the 4.6.4 milestone May 12, 2019
@304NotModified
Copy link
Copy Markdown
Member Author

@snakefoot could you please help me getting this ready?

I doesn't work unfortunately, probably because MutableUnsafe = true. See this screenie when debugging (SimpleLayout.cs)

image

Any idea how to fix that?

Also think this isn't the most efficient way, but dunno how to write a more efficient test.

   public bool TryGetRawValue(LogEventInfo logEvent, out object value)
        {
            var item = Inner.Render(logEvent);
            if (item.Length > 0)
                 ...

       }

@304NotModified 304NotModified changed the base branch from dev to release/4.6.4 May 12, 2019 21:45
@snakefoot
Copy link
Copy Markdown
Contributor

Don't do this:

var item = Inner.Render(logEvent);

Instead check if the raw-value-returned is null or empty-string.

@snakefoot
Copy link
Copy Markdown
Contributor

Created #3398

@304NotModified
Copy link
Copy Markdown
Member Author

Syoer

@304NotModified 304NotModified removed this from the 4.6.4 milestone May 13, 2019
@304NotModified 304NotModified deleted the whenempty-irawvalue branch May 28, 2019 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants