1 // SuperTux Debug Helper Functions
2 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
3 // Copyright (C) 2010 Florian Forster <supertux at octo.it>
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // This program 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.
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "util/log.hpp"
22 #include "math/rectf.hpp"
23 #include "supertux/console.hpp"
25 LogLevel g_log_level = LOG_WARNING;
27 static std::ostream& get_logging_instance (void)
29 if (Console::instance != NULL)
30 return (Console::output);
35 static std::ostream& log_generic_f (const char *prefix, const char* file, int line)
37 get_logging_instance () << prefix << " " << file << ":" << line << " ";
38 return (get_logging_instance ());
41 std::ostream& log_debug_f(const char* file, int line)
43 return (log_generic_f ("[DEBUG]", file, line));
46 std::ostream& log_info_f(const char* file, int line)
48 return (log_generic_f ("[INFO]", file, line));
51 std::ostream& log_warning_f(const char* file, int line)
53 return (log_generic_f ("[WARNING]", file, line));
56 std::ostream& log_fatal_f(const char* file, int line)
58 return (log_generic_f ("[FATAL]", file, line));
61 std::ostream& operator<<(std::ostream& out, const Vector& vector)
63 out << '[' << vector.x << ',' << vector.y << ']';
67 std::ostream& operator<<(std::ostream& out, const Rectf& rect)
69 out << "[" << rect.get_left() << "," << rect.get_top() << " "
70 << rect.get_right() << "," << rect.get_bottom() << "]";