1 /* ResidualVM - A 3D game interpreter 2 * 3 * ResidualVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef GRIM_DEBUG_H 24 #define GRIM_DEBUG_H 25 26 #include "common/debug.h" 27 #include "common/streamdebug.h" 28 29 namespace Grim { 30 31 class Debug { 32 public: 33 enum DebugChannel { 34 Info = 1, 35 Warning = 2 << 0, 36 Error = 2 << 1, 37 Engine = 2 << 2, 38 Lua = 2 << 3, 39 Bitmaps = 2 << 4, 40 Models = 2 << 5, 41 Actors = 2 << 6, 42 Costumes = 2 << 7, 43 Chores = 2 << 8, 44 Fonts = 2 << 9, 45 Keyframes = 2 << 10, 46 Materials = 2 << 11, 47 Movie = 2 << 12, 48 Sound = 2 << 13, 49 Scripts = 2 << 14, 50 Sets = 2 << 15, 51 TextObjects = 2 << 16, 52 Patchr = 2 << 17, 53 Lipsync = 2 << 18, 54 Sprites = 2 << 19 55 }; 56 57 static void registerDebugChannels(); 58 static bool isChannelEnabled(DebugChannel chan); 59 60 /** 61 * Prints a message to the console (stdout), only if the specified debug channel 62 * or the channel Info are active. 63 * 64 * @param channel The debug channel to use. 65 */ 66 static void debug(DebugChannel channel, const char *s, ...); 67 /** 68 * Prints a message to the console (sterr), only if the specified debug channel 69 * or the channel Warning are active. 70 * 71 * @param channel The debug channel to use. 72 */ 73 static void warning(DebugChannel channel, const char *s, ...); 74 /** 75 * Prints a message to the console (stderr) and exit the program immediately, 76 * only if the specified debug channel or the channel Error are active. 77 * 78 * @param channel The debug channel to use. 79 */ 80 static void error(DebugChannel channel, const char *s, ...); 81 /** 82 * Prints a message to the console (stderr) and exit the program immediately, 83 * only if the debug channel Error is active. 84 * 85 * @param channel The debug channel to use. 86 */ 87 static void error(const char *s, ...); 88 }; 89 90 inline Debug::DebugChannel operator|(Debug::DebugChannel a, Debug::DebugChannel b) { 91 return (Debug::DebugChannel)((int)a | (int) b); 92 } 93 94 } 95 96 #endif 97