• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2024 gRPC authors.
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//
16// Automatically generated by tools/codegen/core/gen_trace_flags.py
17//
18
19#include "${absl_prefix}absl/container/flat_hash_map.h"
20
21#include "src/core/lib/debug/trace.h"
22#include "src/core/util/no_destruct.h"
23
24namespace grpc_core {
25
26% for flag, settings in trace_flags.items():
27% if "debug_only" in settings and settings["debug_only"]:
28DebugOnlyTraceFlag ${flag}_trace(${str(settings["default"]).lower()}, "${flag}");
29% endif
30% endfor
31% for flag, settings in trace_flags.items():
32% if "debug_only" not in settings or not settings["debug_only"]:
33TraceFlag ${flag}_trace(${str(settings["default"]).lower()}, "${flag}");
34% endif
35% endfor
36
37const absl::flat_hash_map<std::string, TraceFlag*>& GetAllTraceFlags() {
38  static const NoDestruct<absl::flat_hash_map<std::string, TraceFlag*>>
39      all(absl::flat_hash_map<std::string, TraceFlag*>({
40% for flag, settings in trace_flags.items():
41% if "debug_only" not in settings or not settings["debug_only"]:
42    {"${flag}", &${flag}_trace},
43% endif
44% endfor
45#ifndef NDEBUG
46% for flag, settings in trace_flags.items():
47% if "debug_only" in settings and settings["debug_only"]:
48    {"${flag}", &${flag}_trace},
49% endif
50% endfor
51#endif
52  }));
53  return *all;
54}
55
56}  // namespace grpc_core
57