-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
Description
To provide a simple interceptor like logging start/finish of all methods, users could use a utility method (lightweight) instead of being required to create a class (medium weight for a simple concern).
Example (typed from phone, so pseudo code):
IEquatable<string> sample = EqualityComparer<string>.Default;
// sample name stolen from Rx, if/when implementing spend more time naming
var wrapped = DelegateAsyncInterceptor
.Intercept<IEquatable<string>>(
target: sample,
filter: invocation => true, // optional parameter
beforeInvoke: async () => {}, // Log
afterInvoke: async () => {}); // Log
Or at least
IEquatable<string> sample = EqualityComparer<string>.Default;
// sample name stolen from Rx, if/when implementing spend more time naming
var wrapped = DelegateAsyncInterceptor
.Intercept<IEquatable<string>>(
target: sample,
interceptor:
async (invocation, proceed) =>
{
// TODO: logging
await proceed(invocation);
});
Reactions are currently unavailable