Introduces macro DS_SCOPE_CONTEXT(...)
that stores contextual information
in thread local variable. The idea is that this information will be automatically added to logs
and exceptions thrown by DS_REQUIRE
and DS_ASSERT
from within the scope.
It is analogy to stack trace, but it serializes explicitly provided context variables.
Intented usage:
- web server handler adds processed path, logged user (from token)
To achive the full potential, we need to start using DS_REQUIRE
and DS_FAIL_REQUIRE
to throw exceptions.
Inspired by KJ_CONTEXT
macro from capnproto.