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

Add a way to see a captured log event #206

Open
klitoskyriacou opened this issue Jan 12, 2024 · 1 comment
Open

Add a way to see a captured log event #206

klitoskyriacou opened this issue Jan 12, 2024 · 1 comment

Comments

@klitoskyriacou
Copy link

klitoskyriacou commented Jan 12, 2024

Let's say I have something like this in my production code:

var username = "fred";
MDC.put("user", username);
logger.warn("The user " + username + " has requested xyz");

I would like to be able to check that the message contains a string that matches a certain MDC key:

logCaptureListener.logged(aLog().withMdc("user", ???).withMessage(Mathers.containsString(<whatever was in Mdc>));

Perhaps this feature can be delivered in a similar way to Mockito's or Mockk's "capture" facitilities.

@jsalinaspolo
Copy link
Owner

Let me think about it. I guess we could add Context and keep some data there 🤔

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

No branches or pull requests

2 participants