![]() |
Audacity 3.2.0
|
AudacityLogger is a thread-safe logger class. More...
#include <AudacityLogger.h>
Public Types | |
| using | Listener = std::function< bool() > |
| Type of function called by Flush. More... | |
Public Member Functions | |
| ~AudacityLogger () override | |
| bool | SaveLog (const wxString &fileName) const |
| bool | ClearLog () |
| wxString | GetLog (int count=0) |
| Retrieve all or some of the lines since most recent ClearLog or start of program. More... | |
| const wxString & | GetBuffer () const |
| Get all the accumulated text since program start or last ClearLog() More... | |
| void | Flush () override |
| Listener | SetListener (Listener listener) |
| Set the unique listener, returning any previous one. More... | |
Static Public Member Functions | |
| static AudacityLogger * | Get () |
Protected Member Functions | |
| void | DoLogText (const wxString &msg) override |
Private Member Functions | |
| AudacityLogger () | |
Private Attributes | |
| Listener | mListener |
| wxString | mBuffer |
| bool | mUpdated |
AudacityLogger is a thread-safe logger class.
Provides thread-safe logging based on the wxWidgets log facility.
Definition at line 20 of file AudacityLogger.h.
| using AudacityLogger::Listener = std::function< bool() > |
Type of function called by Flush.
Definition at line 45 of file AudacityLogger.h.
|
overridedefault |
|
private |
Definition at line 51 of file AudacityLogger.cpp.
References mUpdated.
| bool AudacityLogger::ClearLog | ( | ) |
Definition at line 111 of file AudacityLogger.cpp.
References DoLogText(), mBuffer, and wxT().
|
overrideprotected |
Definition at line 73 of file AudacityLogger.cpp.
References _TS, Flush(), mBuffer, mUpdated, str, and wxT().
Referenced by ClearLog().
|
override |
Definition at line 60 of file AudacityLogger.cpp.
References mListener, and mUpdated.
Referenced by DoLogText().
|
static |
Definition at line 35 of file AudacityLogger.cpp.
Referenced by SaveLogCommand::Apply(), ClearLogCommand::Apply(), anonymous_namespace{LogWindow.cpp}::OnClear(), AudacityApp::OnInit0(), QuitAudacity(), DBConnection::SetDBError(), DBConnection::SetError(), and LogWindow::Show().
|
inline |
Get all the accumulated text since program start or last ClearLog()
Definition at line 38 of file AudacityLogger.h.
| wxString AudacityLogger::GetLog | ( | int | count = 0 | ) |
Retrieve all or some of the lines since most recent ClearLog or start of program.
If count == 0 or is more than the number of lines, return all; else return the last count lines
Definition at line 119 of file AudacityLogger.cpp.
References mBuffer, and wxT().
| bool AudacityLogger::SaveLog | ( | const wxString & | fileName | ) | const |
| auto AudacityLogger::SetListener | ( | Listener | listener | ) |
Set the unique listener, returning any previous one.
Definition at line 66 of file AudacityLogger.cpp.
|
private |
Definition at line 57 of file AudacityLogger.h.
Referenced by ClearLog(), DoLogText(), GetLog(), and SaveLog().
|
private |
Definition at line 56 of file AudacityLogger.h.
Referenced by Flush().
|
private |
Definition at line 58 of file AudacityLogger.h.
Referenced by AudacityLogger(), DoLogText(), and Flush().