libopenraw
|
00001 /* 00002 * libopenraw - trace.cpp 00003 * 00004 * Copyright (C) 2006-2007, 2010 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 License 00008 * as published by the Free Software Foundation, either version 3 of 00009 * 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, see 00018 * <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 00022 #include <iostream> 00023 00024 #include "trace.h" 00025 00026 00027 00028 namespace Debug { 00029 00030 int Trace::debugLevel = NOTICE; 00031 00032 void Trace::setDebugLevel(debug_level lvl) 00033 { 00034 debugLevel = lvl; 00035 } 00036 00037 void Trace::print(int i) 00038 { 00039 std::cerr << i << " "; 00040 } 00041 00042 Trace & Trace::operator<<(int i) 00043 { 00044 if (m_level <= debugLevel) { 00045 std::cerr << i; 00046 } 00047 return *this; 00048 } 00049 00050 Trace & Trace::operator<<(const char * s) 00051 { 00052 if (m_level <= debugLevel) { 00053 std::cerr << s; 00054 } 00055 return *this; 00056 } 00057 00058 Trace & Trace::operator<<(void *p) 00059 { 00060 if (m_level <= debugLevel) { 00061 std::cerr << p; 00062 } 00063 return *this; 00064 } 00065 00066 Trace & Trace::operator<<(const std::string & s) 00067 { 00068 if (m_level <= debugLevel) { 00069 std::cerr << s; 00070 } 00071 return *this; 00072 } 00073 00074 }