I'm actually facing a problem with TPL dataflow (it seems that an item is added twice). Therefore I wanted to know if there is the option to inject a callback, which I can use for logging, if an item is posted to a target block. I checked the ActionBlock
, BufferBlock
constructors, and also the LinkTo
methods but didn't find anything.
Any hints?
No, as the TPL Dataflow is quite lightweight library, you need to do a decorator block instead, or use some logging buffer, like TransformBlock
which basically just logs the message, something like this:
var loggingTransform = new TransformBlock<TIn, TOut>(m =>
{
Logger.Info(m);
return m;
});
Some useful links: