1 // $Id: debug.cpp 2650 2005-06-28 12:42:08Z sommer $
3 // SuperTux Debug Helper Functions
4 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 #ifndef __SUPERTUX_MSG_H__
22 #define __SUPERTUX_MSG_H__
27 #include "console.hpp"
33 inline std::ostream& msg_debug_f(const char* file, int line) {
34 Console::output << "[DEBUG] " << file << " l." << line << ": ";
35 return Console::output;
38 inline std::ostream& msg_info_f(const char* file, int line) {
39 Console::output << "[INFO] " << file << " l." << line << ": ";
40 return Console::output;
43 inline std::ostream& msg_warning_f(const char* file, int line) {
44 Console::output << "[WARNING] " << file << " l." << line << ": ";
45 return Console::output;
48 inline std::ostream& msg_fatal_f(const char* file, int line) {
49 Console::output << "[FATAL] " << file << " l." << line << ": ";
50 return Console::output;
55 #define msg_debug msg_debug_f(__FILE__, __LINE__)
56 #define msg_info msg_info_f(__FILE__, __LINE__)
57 #define msg_warning msg_warning_f(__FILE__, __LINE__)
58 #define msg_fatal msg_fatal_f(__FILE__, __LINE__)
64 inline std::ostream& msg_warning_f() {
65 Console::output << "Warning: ";
66 return Console::output;
69 inline std::ostream& msg_fatal_f() {
70 Console::output << "Fatal: ";
71 return Console::output;
76 #define msg_debug if (0) std::cerr
77 #define msg_info Console::output
78 #define msg_warning msg_warning_f()
79 #define msg_fatal msg_fatal_f()