MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / create_printers

Method create_printers

tests/framework/command_line/CommonOptions.cpp:100–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 pretty_file->set_help("Write output to a text file");
99}
100std::vector<std::unique_ptr<Printer>> CommonOptions::create_printers()
101{
102 std::vector<std::unique_ptr<Printer>> printers;
103
104 if (pretty_console->value() && (log_file->is_set() || log_format->value() != LogFormat::PRETTY))
105 {
106 auto pretty_printer = std::make_unique<PrettyPrinter>();
107 pretty_printer->set_color_output(color_output->value());
108 printers.push_back(std::move(pretty_printer));
109 }
110
111 std::unique_ptr<Printer> printer;
112 switch (log_format->value())
113 {
114 case LogFormat::JSON:
115 printer = std::make_unique<JSONPrinter>();
116 break;
117 case LogFormat::NONE:
118 break;
119 case LogFormat::PRETTY:
120 default:
121 auto pretty_printer = std::make_unique<PrettyPrinter>();
122 // Don't use colours if we print to a file:
123 pretty_printer->set_color_output((!log_file->is_set()) && color_output->value());
124 printer = std::move(pretty_printer);
125 break;
126 }
127
128 if (log_file->is_set())
129 {
130 log_streams.push_back(std::make_shared<std::ofstream>(log_file->value()));
131 if (printer != nullptr)
132 {
133 printer->set_stream(*log_streams.back().get());
134 }
135 }
136
137 if (printer != nullptr)
138 {
139 printers.push_back(std::move(printer));
140 }
141
142 if (json_file->is_set())
143 {
144 printers.push_back(std::make_unique<JSONPrinter>());
145 log_streams.push_back(std::make_shared<std::ofstream>(json_file->value()));
146 printers.back()->set_stream(*log_streams.back().get());
147 }
148
149 if (pretty_file->is_set())
150 {
151 printers.push_back(std::make_unique<PrettyPrinter>());
152 log_streams.push_back(std::make_shared<std::ofstream>(pretty_file->value()));
153 printers.back()->set_stream(*log_streams.back().get());
154 }
155
156 return printers;
157}

Callers 3

mainFunction · 0.80
run_exampleFunction · 0.80
run_exampleFunction · 0.80

Calls 5

is_setMethod · 0.80
set_color_outputMethod · 0.80
push_backMethod · 0.80
set_streamMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected