Overpass API regression suite coverage (Nova Scotia) / overpass_api/frontend/console_output.cc

overpass_api/frontend/console_output.cc

22 of 49 instrumented lines run by the suite (44.9%) at 8edf11b0419c (this file on GitHub).

runnever runcolumns: line, executions, queries (click for the queries that run the line)

1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.
2 *
3 * This file is part of Overpass_API.
4 *
5 * Overpass_API is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * Overpass_API is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.
17 */
19#include <iomanip>
20#include <iostream>
21#include <string>
23#include "console_output.h"
26void Console_Output::add_encoding_error(const std::string& error)
270{
280 if (log_level != Error_Output::QUIET)
290 std::cerr<<"encoding error: "<<error<<'\n';
300 encoding_errors = true;
310}
33void Console_Output::add_parse_error(const std::string& error, int line_number)
3418423 q{
3518423 q if (log_level != Error_Output::QUIET)
3618423 q std::cerr<<"line "<<line_number<<": parse error: "<<error<<'\n';
3718423 q parse_errors = true;
3818423 q}
40void Console_Output::add_static_error(const std::string& error, int line_number)
42134 q if (log_level != Error_Output::QUIET)
43134 q std::cerr<<"line "<<line_number<<": static error: "<<error<<'\n';
44134 q static_errors = true;
47void Console_Output::add_encoding_remark(const std::string& error)
482480612 q{
492480612 q if (log_level >= Error_Output::ASSISTING)
502480612 q std::cerr<<"encoding remark: "<<error<<'\n';
512480612 q}
53void Console_Output::add_parse_remark(const std::string& error, int line_number)
540{
550 if (log_level >= Error_Output::ASSISTING)
560 std::cerr<<"line "<<line_number<<": parse remark: "<<error<<'\n';
570}
59void Console_Output::add_static_remark(const std::string& error, int line_number)
600{
610 if (log_level >= Error_Output::ASSISTING)
620 std::cerr<<"line "<<line_number<<": static remark: "<<error<<'\n';
630}
65void Console_Output::runtime_error(const std::string& error)
6766 q if (log_level != Error_Output::QUIET)
6866 q std::cerr<<"runtime error: "<<error<<'\n';
71void Console_Output::runtime_remark(const std::string& error)
73595595 q if (log_level >= Error_Output::ASSISTING)
74595595 q std::cerr<<"runtime remark: "<<error<<'\n';
77void Console_Output::display_statement_progress
78 (uint timer, const std::string& name, int progress, int line_number,
79 const std::vector< std::pair< uint, uint > >& stack)
800{
810 if (log_level < Error_Output::PROGRESS)
820 return;
830 std::cerr<<"After "<<timer/3600<<"h"<<timer/60%60<<"m"<<timer%60<<"s: "
840 <<"in \""<<name<<"\", part "<<progress<<", on line "<<line_number<<".";
850 if (!stack.empty())
860 {
870 std::cerr<<" Stack:";
880 for (std::vector< std::pair< uint, uint > >::const_iterator it(stack.begin());
890 it != stack.end(); ++it)
900 std::cerr<<" "<<it->first<<" of "<<it->second;
910 }
920 std::cerr<<'\n';
930}