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

Implement IRawValue on ${whenEmpty} #3395

Closed
wants to merge 1 commit into from

Conversation

304NotModified
Copy link
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
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
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
Contributor

Created #3398

@304NotModified
Copy link
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.

None yet

2 participants