1 /* Copyright (C) 2014 InfiniDB, Inc. 2 3 This program is free software; you can redistribute it and/or 4 modify it under the terms of the GNU General Public License 5 as published by the Free Software Foundation; version 2 of 6 the License. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 MA 02110-1301, USA. */ 17 18 /* 19 * $Id: logger.h 706 2008-09-16 18:25:49Z bwelch $ 20 */ 21 22 /** @file */ 23 24 #ifndef PRIMPROC_LOGGER_H_ 25 #define PRIMPROC_LOGGER_H_ 26 27 #include <map> 28 #include <boost/thread.hpp> 29 30 #include "messageobj.h" 31 #include "messagelog.h" 32 33 namespace primitiveprocessor 34 { 35 36 /** @brief message log wrapper class */ 37 class Logger 38 { 39 public: 40 Logger(); 41 42 void logMessage(const logging::Message::MessageID mid, 43 const logging::Message::Args& args, 44 bool critical = false); 45 46 void logMessage(const std::string& msg, bool critical = true, logging::Message::MessageID mid = 0 ) 47 { 48 logging::Message::Args args; 49 args.add(msg); 50 logMessage(mid, args, true); 51 } 52 53 private: 54 // defaults okay 55 //Logger(const Logger& rhs); 56 //Logger& operator=(const Logger& rhs); 57 58 typedef std::map<logging::Message::MessageID, logging::Message> MsgMap; 59 60 MsgMap fMsgMap; 61 boost::mutex fLogLock; 62 logging::MessageLog fMl1; 63 }; 64 65 66 } 67 68 #endif 69 70