1 /* 2 * This file is part of Licq, an instant messaging client for UNIX. 3 * Copyright (C) 2010-2011 Licq developers 4 * 5 * Licq is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * Licq is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Licq; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef LICQDAEMON_LOGSERVICE_H 21 #define LICQDAEMON_LOGSERVICE_H 22 23 #include <licq/logging/logservice.h> 24 #include <licq/thread/threadspecificdata.h> 25 #include "logging/log.h" 26 #include "logging/logdistributor.h" 27 28 namespace LicqDaemon 29 { 30 31 class LogService : public Licq::LogService 32 { 33 public: 34 LogService(); 35 ~LogService(); 36 getLog()37 Log& getLog() { return myLog; } 38 Log* getThreadLog() const; 39 40 void registerDefaultLogSink(Licq::AdjustableLogSink::Ptr logSink); 41 42 // From Licq::LogService 43 Licq::Log::Ptr createLog(const std::string& name); 44 void createThreadLog(const std::string& name); 45 void registerLogSink(Licq::LogSink::Ptr logSink); 46 void unregisterLogSink(Licq::LogSink::Ptr logSink); 47 Licq::AdjustableLogSink::Ptr getDefaultLogSink(); 48 49 private: 50 LogDistributor myLogDistributor; 51 Log myLog; 52 Licq::ThreadSpecificData<Log> myThreadLogs; 53 Licq::AdjustableLogSink::Ptr myDefaultLogSink; 54 }; 55 56 extern LogService gLogService; 57 58 } // namespace LicqDaemon 59 60 #endif 61