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"
31 inline std::ostream& msg_debug_f(const char* file, int line) {
32 Console::output << "[DEBUG] " << file << " l." << line << ": ";
33 return Console::output;
36 inline std::ostream& msg_info_f(const char* file, int line) {
37 Console::output << "[INFO] " << file << " l." << line << ": ";
38 return Console::output;
41 inline std::ostream& msg_warning_f(const char* file, int line) {
42 Console::output << "[WARNING] " << file << " l." << line << ": ";
43 return Console::output;
46 inline std::ostream& msg_fatal_f(const char* file, int line) {
47 Console::output << "[FATAL] " << file << " l." << line << ": ";
48 return Console::output;
51 #define msg_debug msg_debug_f(__FILE__, __LINE__)
52 #define msg_info msg_info_f(__FILE__, __LINE__)
53 #define msg_warning msg_warning_f(__FILE__, __LINE__)
54 #define msg_fatal msg_fatal_f(__FILE__, __LINE__)
58 inline std::ostream& msg_debug_f(const char* file, int line) {
59 return Console::output;
62 inline std::ostream& msg_info_f(const char* file, int line) {
63 return Console::output;
66 inline std::ostream& msg_warning_f(const char* file, int line) {
67 Console::output << "Warning: ";
68 return Console::output;
71 inline std::ostream& msg_fatal_f(const char* file, int line) {
72 Console::output << "Fatal: ";
73 return Console::output;
76 #define msg_debug if (0) msg_debug_f(__FILE__, __LINE__)
77 #define msg_info msg_info_f(__FILE__, __LINE__)
78 #define msg_warning msg_warning_f(__FILE__, __LINE__)
79 #define msg_fatal msg_fatal_f(__FILE__, __LINE__)