26#include <wx/tokenzr.h>
37 static std::once_flag
flag;
38 std::call_once(
flag, []{
42 std::unique_ptr < wxLog >
68 auto result = std::move(mListener);
69 mListener = std::move(listener);
75 if (!wxIsMainThread()) {
84 mBuffer << stamp <<
_TS(
"Audacity ") << AUDACITY_VERSION_STRING <<
wxT(
"\n");
93 if (!wxIsMainThread()) {
100 wxFFile file(fileName,
wxT(
"w"));
102 if (file.IsOpened()) {
128 auto lines = wxStringTokenize(
mBuffer,
wxT(
"\r\n"), wxTOKEN_RET_DELIMS);
129 for (
int index = lines.size() - 1; index >= 0 && count > 0; --index, --count)
131 buffer.Prepend(lines[index]);
AudacityLogger is a thread-safe logger class.
~AudacityLogger() override
std::function< bool() > Listener
Type of function called by Flush.
bool SaveLog(const wxString &fileName) const
static AudacityLogger * Get()
wxString GetLog(int count=0)
Retrieve all or some of the lines since most recent ClearLog or start of program.
Listener SetListener(Listener listener)
Set the unique listener, returning any previous one.
void DoLogText(const wxString &msg) override