Interaction with other Vostok libraries
The main value of Vostok.Context – integration with other Vostok libraries.
Context + ClusterClient
Use the ClusterClient.Context, if you want to spread the context across the network. You can look at the example here.
Context + Logging
Logging.Context enables us to say: "Let's automatically add properties from context to that log".
If you use ContextualLogPrefix
, you can do so:
var log = new ConsoleLog().WithContextualPrefix();
using (new ContextualLogPrefix("op-1"))
{
log.Info("Message 1!");
using (new ContextualLogPrefix("op-2"))
{
log.Info("Message 2!");
}
log.Info("Message 3!");
}
ConsoleLog.Flush();
Result:
2018-11-11 16:06:37,970 INFO [op-1] Message 1!
2018-11-11 16:06:38,047 INFO [op-1] [op-2] Message 2!
2018-11-11 16:06:38,047 INFO [op-1] Message 3!
Context + Tracing
__/\_/\__ | 0 0 | / ____ \ |_|_|_|_|_|_|_|
Last updated
Was this helpful?