Changeset 5896 for branches/newapi
- Timestamp:
- 12/02/07 02:11:45 (12 months ago)
- Location:
- branches/newapi/licq/src/util
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/newapi/licq/src/util/log.cpp
r5498 r5896 19 19 20 20 #include "licq/interface/logsink.h" 21 #include "licq/thread/threadspecific.h" 21 22 #include "util/log.h" 23 #include "util/tr.h" 22 24 23 25 #include <cassert> … … 25 27 #include <time.h> 26 28 29 static Licq::ThreadSpecific<LicqDaemon::Log> ThreadLogs; 30 27 31 LicqDaemon::Log::Log(const std::string& owner, Licq::LogSink* sink) 28 32 : myOwner(owner), mySink(sink) 29 33 { 30 34 assert(mySink != NULL); 35 } 36 37 void LicqDaemon::Log::setThreadLog(const Log* log) 38 { 39 if (ThreadLogs.hasData()) 40 { 41 ThreadLogs.getData()->fatal() << 42 tr("LicqDaemon::Log::setThreadLog called more than once"); 43 ::abort(); 44 } 45 ThreadLogs.setData(log); 46 } 47 48 LicqDaemon::Log* LicqDaemon::Log::getThreadLog() 49 { 50 assert(ThreadLogs.hasData()); 51 return ThreadLogs.getData(); 31 52 } 32 53 -
branches/newapi/licq/src/util/log.h
r5498 r5896 44 44 Log(const std::string& owner, Licq::LogSink* sink); 45 45 46 /** 47 * Makes @a log the default log for the calling thread. @a log will 48 * be automatically deleted when the thread exits. This method may 49 * only be called once per thread. 50 * 51 * @see getThreadLog() 52 */ 53 static void setThreadLog(const Log* log); 54 55 /** 56 * @returns The default log for the calling thread. setThreadLog() 57 * must have been called by the calling thread before calling this 58 * method. 59 * 60 * @see setThreadLog() 61 */ 62 static Log* getThreadLog(); 63 46 64 // From Licq::Log 47 65 void log(Level level, const std::string& msg);
