00001 /* 00002 * libopenraw - debug.cpp 00003 * 00004 * Copyright (C) 2006 Hubert Figuiere 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 00022 #include <iostream> 00023 00024 #include "debug.h" 00025 00026 00027 00028 namespace Debug { 00029 00030 int debugLevel = NOTICE; 00031 00032 void Trace::setDebugLevel(debug_level lvl) 00033 { 00034 debugLevel = lvl; 00035 } 00036 00037 00038 Trace & Trace::operator<<(int i) 00039 { 00040 if (m_level <= debugLevel) { 00041 std::cerr << i; 00042 } 00043 return *this; 00044 } 00045 00046 Trace & Trace::operator<<(const char * s) 00047 { 00048 if (m_level <= debugLevel) { 00049 std::cerr << s; 00050 } 00051 return *this; 00052 } 00053 00054 Trace & Trace::operator<<(void *p) 00055 { 00056 if (m_level <= debugLevel) { 00057 std::cerr << p; 00058 } 00059 return *this; 00060 } 00061 00062 }