Logging tweaks.

More pieces to support logging to buffers in the GUI.
This commit is contained in:
James Turner
2013-02-08 19:37:29 +00:00
parent 70f334e1a3
commit 318c5000ce
4 changed files with 81 additions and 14 deletions
+14 -1
View File
@@ -37,9 +37,20 @@ public:
BufferedLogCallback(sgDebugClass c, sgDebugPriority p);
virtual ~BufferedLogCallback();
/// truncate messages longer than a certain length. This is to work-around
/// for broken PUI behaviour, it can be removed once PUI is gone.
void truncateAt(unsigned int);
virtual void operator()(sgDebugClass c, sgDebugPriority p,
const char* file, int line, const std::string& aMessage);
/**
* read the stamp value associated with the log buffer. This is
* incremented whenever the log contents change, so can be used
* to poll for changes.
*/
unsigned int stamp() const;
/**
* copying a (large) vector of std::string would be very expensive.
* once logged, this call retains storage of the underlying string data,
@@ -53,8 +64,10 @@ public:
* copy the buffered log data into the provided output list
* (which will be cleared first). This method is safe to call from
* any thread.
*
* returns the stamp value of the copied data
*/
void threadsafeCopy(vector_cstring& aOutput);
unsigned int threadsafeCopy(vector_cstring& aOutput);
private:
class BufferedLogCallbackPrivate;
std::auto_ptr<BufferedLogCallbackPrivate> d;