MCPcopy Create free account
hub / github.com/apache/trafficserver / loadLogConfig

Method loadLogConfig

src/proxy/logging/YamlLogConfig.cc:54–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54bool
55YamlLogConfig::loadLogConfig(const char *cfgFilename)
56{
57 YAML::Node config = YAML::LoadFile(cfgFilename);
58
59 if (config.IsNull()) {
60 return false;
61 }
62
63 if (!config.IsMap()) {
64 Error("malformed %s file; expected a map", cfgFilename);
65 return false;
66 }
67
68 if (config["logging"]) {
69 config = config["logging"];
70 } else {
71 Error("malformed %s file; expected a toplevel 'logging' node", cfgFilename);
72 return false;
73 }
74
75 auto formats = config["formats"];
76 for (auto const &node : formats) {
77 auto fmt = node.as<std::unique_ptr<LogFormat>>().release();
78 if (fmt->valid()) {
79 cfg->format_list.add(fmt, false);
80
81 if (dbg_ctl_log.on()) {
82 printf("The following format was added to the global format list\n");
83 fmt->display(stdout);
84 }
85 } else {
86 Note("Format named \"%s\" will not be active; not a valid format", fmt->name() ? fmt->name() : "");
87 delete fmt;
88 }
89 }
90
91 auto filters = config["filters"];
92 for (auto const &node : filters) {
93 auto filter = node.as<std::unique_ptr<LogFilter>>().release();
94
95 if (filter) {
96 cfg->filter_list.add(filter, false);
97
98 if (dbg_ctl_xml.on()) {
99 printf("The following filter was added to the global filter list\n");
100 filter->display(stdout);
101 }
102 }
103 }
104
105 auto logs = config["logs"];
106 for (auto const &node : logs) {
107 auto obj = decodeLogObject(node);
108 if (obj) {
109 cfg->log_object_manager.manage_object(obj);
110 }
111 }

Callers

nothing calls this directly

Calls 9

LoadFileFunction · 0.85
manage_objectMethod · 0.80
ErrorClass · 0.50
releaseMethod · 0.45
validMethod · 0.45
addMethod · 0.45
onMethod · 0.45
displayMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected