Internals
ContextVariablesX.current_logger
— MethodContextVariablesX.current_logger() -> logger::AbstractLogger
Like Logging.current_logger
but unwraps ContextPayloadLogger
.
ContextVariablesX.genkey
— Methodgenkey(__module__::Module, varname::Symbol) -> Union{UUID,Nothing}.
Generate a stable UUID for a context variable __module__.$varname
.
ContextVariablesX.merge_ctxvars
— Methodmerge_ctxvars(ctx::Union{Nothing,T}, kvs) -> ctx′:: Union{Nothing,T}
This is not a public API. This documentation is for making it easier to experiment with different implementations of the context variable storage backend, by monkey-patching it at run-time. When this function is monkey-patched, ctxvars_type
should also be monkey-patched to return the type T
.
The first argument ctx
is either nothing
or a dict-like object of type T
where its keytype
is UUID
and valtype
is Any
. The second argument kvs
is an iterable of Pair{UUID,<:Union{Some,Nothing}}
values. Iterable kvs
must have length.
If ctx
is nothing
and kvs
is non-empty, merge_ctxvars
creates a new instance of T
. If ctx
is not nothing
, it returns a shallow-copy ctx′
of ctx
where k => v
is inserted to ctx′
for each k => Some(v)
in kvs
and k
is deleted from ctx′
for each k => nothing
in kvs
.
ContextVariablesX.with_logger
— MethodContextVariablesX.with_logger(f, logger::AbstractLogger)
Like Logging.with_logger
but properly propagate the context variables.