| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #include "BsLog.h"
- #include "BsException.h"
- namespace BansheeEngine
- {
- LogEntry::LogEntry(const String& msg, UINT32 channel)
- :mMsg(msg), mChannel(channel)
- { }
- Log::Log()
- {
- }
- Log::~Log()
- {
- BS_LOCK_RECURSIVE_MUTEX(mMutex);
- for(auto iter = mEntries.begin(); iter != mEntries.end(); ++iter)
- bs_delete(*iter);
- }
- void Log::logMsg(const String& message, UINT32 channel)
- {
- BS_LOCK_RECURSIVE_MUTEX(mMutex);
- LogEntry* newEntry = bs_new<LogEntry>(message, channel);
- mEntries.push_back(newEntry);
- doOnEntryAdded(*newEntry);
- }
- void Log::clear()
- {
- BS_LOCK_RECURSIVE_MUTEX(mMutex);
- for(auto iter = mEntries.begin(); iter != mEntries.end(); ++iter)
- bs_delete(*iter);
- mEntries.clear();
- }
- void Log::doOnEntryAdded(const LogEntry& entry)
- {
- onEntryAdded(entry);
- }
- }
|