witchcraft_server/logging/mdc.rs
1// Copyright 2022 Palantir Technologies, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! MDC keys managed by Witchcraft.
16//!
17//! All keys in the `witchcraft_log::mdc` will be included as parameters in service logs emitted
18//! by Witchcraft. However, there are some keys that are treated specially.
19//!
20//! These keys are set automatically by Witchcraft and will be written to specific keys in the log
21//! message rather than the generic params map.
22
23/// The safe MDC key storing the value for the `uid` field in service logs.
24pub const UID_KEY: &str = "\0witchcraft-uid";
25/// The safe MDC key storing the value for the `sid` field in service logs.
26pub const SID_KEY: &str = "\0witchcraft-sid";
27/// The safe MDC key storing the value for the `tokenId` field in service logs.
28pub const TOKEN_ID_KEY: &str = "\0witchcraft-token-id";
29/// The safe MDC key storing the value for the `orgId` field in service logs.
30pub const ORG_ID_KEY: &str = "\0witchcraft-org-id";
31/// The safe MDC key storing the value for the `traceId` field in service logs.
32pub const TRACE_ID_KEY: &str = "\0witchcraft-trace-id";