casa
5.7.0-16
|
A PlotLogger is used to log messages to an underlying CASA log object, as well as provide access to different logging functionality like measurements. More...
#include <PlotLogger.h>
Public Member Functions | |
PlotLogger (Plotter *plotter, int filterEventFlags=NO_EVENTS, casacore::LogMessage::Priority filterMinPriority=casacore::LogMessage::DEBUGGING) | |
Non-Static //. More... | |
virtual | ~PlotLogger () |
Destructor. More... | |
casacore::CountedPtr < casacore::LogSinkInterface > | sink () |
Log IO Methods //. More... | |
const casacore::CountedPtr < casacore::LogSinkInterface > | sink () const |
casacore::LogSinkInterface * | localSinkCopy () const |
Gets a copy of the log sink interface, IF it is not the global. More... | |
const casacore::String & | sinkLocation () const |
Gets/Sets the log sink file location. More... | |
void | setSinkLocation (const casacore::String &logFile) |
bool | usingGlobalSink () const |
Returns true if the logger is currently using the global sink, false otherwise. More... | |
casacore::LogMessage::Priority | filterMinPriority () const |
Filtering Methods //. More... | |
void | setFilterMinPriority (PlotLogMessage::Priority minPriority) |
bool | filterEventFlag (int flag) const |
Gets/Sets the log filter event flag for a single event type. More... | |
void | setFilterEventFlag (int flag, bool on) |
int | filterEventFlags () const |
Gets/Sets the log filter event flag(s). More... | |
void | setFilterEventFlags (int flags) |
void | postMessage (const PlotLogMessage &message) |
Message Methods //. More... | |
void | postMessage (const casacore::String &origin1, const casacore::String &origin2, const casacore::String &message, int eventType=PlotLogMessage::DEFAULT_EVENT_TYPE) |
PlotLogMessage | markMeasurement (const casacore::String &origin1, const casacore::String &origin2, int eventType=PlotLogMessage::DEFAULT_EVENT_TYPE, bool postStartMessage=true) |
Measurement Methods //. More... | |
PlotLogMeasurement | releaseMeasurement (bool postReleaseMessage=true) |
Gets the measurement since the last mark. More... | |
PlotLogLocate | locate (PlotCanvas *canvas, const PlotRegion ®ion, int eventType=MSG_INFO, bool postLocateMessage=true) |
Locate Methods //. More... | |
Static Public Member Functions | |
static int | ALL_EVENTS_FLAG () |
All events as a flag. More... | |
static std::vector< int > | ALL_EVENTS () |
All events as a vector. More... | |
static int | REGISTER_EVENT_TYPE (const casacore::String &name, casacore::LogMessage::Priority priority=casacore::LogMessage::NORMAL) |
Registers an extended event type with the given name and optional priority and returns its value. More... | |
static void | UNREGISTER_EVENT_TYPE (int event) |
Unregisters the given extended event type. More... | |
static void | UNREGISTER_EVENT_TYPE (const casacore::String &name) |
static std::vector < casacore::String > | EVENT_NAMES () |
Returns all the event names. More... | |
static casacore::String | EVENT (int type) |
Converts between an event type and its name. More... | |
static int | EVENT (const casacore::String &name) |
static int | FLAG_FROM_EVENTS (const std::vector< int > &events) |
Returns an event flag from the given vector. More... | |
static int | FLAG_FROM_EVENTS (const std::vector< casacore::String > &names) |
static int | FLAG_FROM_PRIORITY (casacore::LogMessage::Priority minPriority) |
Returns an event flag for all events that meet the given minimum priority. More... | |
static casacore::LogMessage::Priority | EVENT_PRIORITY (int event) |
Gets/Sets the message priority for the given log event. More... | |
static void | SET_EVENT_PRIORITY (int event, casacore::LogMessage::Priority priority) |
static void | disableGlobalSink () |
Disables the global sink until enableGlobalSink() is called. More... | |
static void | enableGlobalSink () |
Re-enables the global sink. More... | |
Static Public Attributes | |
static const int | MSG_INFO |
Static //. More... | |
static const int | MSG_WARN |
static const int | MSG_ERROR |
static const int | MSG_DEBUG |
Miscellaneous debugging messages. More... | |
static const int | DRAW_TOTAL |
Replotting/redrawing the whole GUI. More... | |
static const int | DRAW_INDIVIDUAL |
Replotting/redrawing each plot item. More... | |
static const int | METHODS_MAJOR |
Entering/exiting major methods. More... | |
static const int | OBJECTS_MAJOR |
Creation/deletion of major objects. More... | |
static const int | EXPORT_TOTAL |
Exporting canvases to file. More... | |
static const int | NO_EVENTS |
No events. More... | |
Private Attributes | |
casacore::CountedPtr < casacore::LogSinkInterface > | m_logger |
Log sink. More... | |
PlotLoggerFilter | m_filter |
Log filter. More... | |
casacore::String | m_loggerLocation |
Log sink location. More... | |
std::vector< PlotLogMeasurement > | m_measurements |
Current measurement marks. More... | |
Static Private Attributes | |
static std::vector< int > | EXTENDED_TYPES |
Static //. More... | |
static std::vector < casacore::String > | EXTENDED_NAMES |
Registered extended type names. More... | |
static std::map< int, casacore::LogMessage::Priority > | EVENT_PRIORITIES |
casacore::Map from log event to priority. More... | |
static casacore::LogFilterInterface * | DISABLED_GLOBAL_FILTER |
Disabled old global filter, or null. More... | |
A PlotLogger is used to log messages to an underlying CASA log object, as well as provide access to different logging functionality like measurements.
PlotLogger is associated with a single Plotter object and should be used by all children of that Plotter (canvases, plot items, etc.) to report their behavior if the proper flag is turned on. The logger can also filter out messages by priority. Therefore a message must BOTH have its event type flag turned on, AND meet the priority minimum in order to be posted to the log. The exception to this is for the MSG_* event types, which are logged as long as they meet the filtered priority requirement. The actual log can either be the global sink, or can be set to a file.
Definition at line 328 of file PlotLogger.h.
casa::PlotLogger::PlotLogger | ( | Plotter * | plotter, |
int | filterEventFlags = NO_EVENTS , |
||
casacore::LogMessage::Priority | filterMinPriority = casacore::LogMessage::DEBUGGING |
||
) |
Non-Static //.
Constructor which takes the Plotter this logger is associated with. The global log sink is used, and the minimum priority filter is set.
|
virtual |
Destructor.
|
static |
All events as a vector.
|
static |
All events as a flag.
|
static |
Disables the global sink until enableGlobalSink() is called.
Can be used when something posts undesirably to both the local and global logs.
|
static |
Re-enables the global sink.
See disableGlobalSink().
|
static |
Converts between an event type and its name.
|
static |
|
static |
Returns all the event names.
|
static |
Gets/Sets the message priority for the given log event.
Uses a default if the event has not been set.
bool casa::PlotLogger::filterEventFlag | ( | int | flag | ) | const |
Gets/Sets the log filter event flag for a single event type.
int casa::PlotLogger::filterEventFlags | ( | ) | const |
Gets/Sets the log filter event flag(s).
The flag should be a bitwise-or of one or more values in PlotLogger events and any extended event types.
casacore::LogMessage::Priority casa::PlotLogger::filterMinPriority | ( | ) | const |
Filtering Methods //.
Gets/Sets the log filter priority level.
|
static |
Returns an event flag from the given vector.
|
static |
|
static |
Returns an event flag for all events that meet the given minimum priority.
casacore::LogSinkInterface* casa::PlotLogger::localSinkCopy | ( | ) | const |
Gets a copy of the log sink interface, IF it is not the global.
PlotLogLocate casa::PlotLogger::locate | ( | PlotCanvas * | canvas, |
const PlotRegion & | region, | ||
int | eventType = MSG_INFO , |
||
bool | postLocateMessage = true |
||
) |
Locate Methods //.
Calls locate on the given canvas and returns the result as a message that will also be posted if postLocateMessage is true.
PlotLogMessage casa::PlotLogger::markMeasurement | ( | const casacore::String & | origin1, |
const casacore::String & | origin2, | ||
int | eventType = PlotLogMessage::DEFAULT_EVENT_TYPE , |
||
bool | postStartMessage = true |
||
) |
Measurement Methods //.
Marks the logger to begin a time/memory measurement. Measurement marks can be recursive. Returns a generic message saying that measurement has begun, which will be also posted to the log if postStartMessage is true.
void casa::PlotLogger::postMessage | ( | const PlotLogMessage & | message | ) |
Message Methods //.
Posts the given message to the underlying log sink.
void casa::PlotLogger::postMessage | ( | const casacore::String & | origin1, |
const casacore::String & | origin2, | ||
const casacore::String & | message, | ||
int | eventType = PlotLogMessage::DEFAULT_EVENT_TYPE |
||
) |
|
static |
Registers an extended event type with the given name and optional priority and returns its value.
PlotLogMeasurement casa::PlotLogger::releaseMeasurement | ( | bool | postReleaseMessage = true | ) |
Gets the measurement since the last mark.
The message will also be posted to the log if postReleaseMessage is true.
|
static |
void casa::PlotLogger::setFilterEventFlag | ( | int | flag, |
bool | on | ||
) |
void casa::PlotLogger::setFilterEventFlags | ( | int | flags | ) |
void casa::PlotLogger::setFilterMinPriority | ( | PlotLogMessage::Priority | minPriority | ) |
void casa::PlotLogger::setSinkLocation | ( | const casacore::String & | logFile | ) |
casacore::CountedPtr<casacore::LogSinkInterface> casa::PlotLogger::sink | ( | ) |
Log IO Methods //.
Gets the log sink interface.
const casacore::CountedPtr<casacore::LogSinkInterface> casa::PlotLogger::sink | ( | ) | const |
const casacore::String& casa::PlotLogger::sinkLocation | ( | ) | const |
Gets/Sets the log sink file location.
If the filename is empty, it means the global sink.
Referenced by usingGlobalSink().
|
static |
Unregisters the given extended event type.
If a priority has been set, it is NOT removed.
|
static |
|
inline |
Returns true if the logger is currently using the global sink, false otherwise.
Definition at line 449 of file PlotLogger.h.
References casacore::String::empty(), and sinkLocation().
|
staticprivate |
Disabled old global filter, or null.
Definition at line 532 of file PlotLogger.h.
|
static |
Replotting/redrawing each plot item.
Definition at line 348 of file PlotLogger.h.
|
static |
Replotting/redrawing the whole GUI.
Definition at line 345 of file PlotLogger.h.
|
staticprivate |
casacore::Map from log event to priority.
Definition at line 529 of file PlotLogger.h.
|
static |
Exporting canvases to file.
Definition at line 357 of file PlotLogger.h.
|
staticprivate |
Registered extended type names.
Definition at line 526 of file PlotLogger.h.
|
staticprivate |
|
private |
Log filter.
Definition at line 511 of file PlotLogger.h.
|
private |
Log sink.
Definition at line 508 of file PlotLogger.h.
|
private |
Log sink location.
Definition at line 514 of file PlotLogger.h.
|
private |
Current measurement marks.
Definition at line 517 of file PlotLogger.h.
|
static |
Entering/exiting major methods.
Definition at line 351 of file PlotLogger.h.
|
static |
Miscellaneous debugging messages.
Definition at line 342 of file PlotLogger.h.
Referenced by casa::PlotMSIndexer::logDebug(), and casa::PlotMSCacheBase::logDebug().
|
static |
Definition at line 338 of file PlotLogger.h.
Referenced by casa::PlotMSIndexer::logError(), and casa::PlotMSCacheBase::logError().
|
static |
Static //.
Event types //
Event types that are always allowed.
Definition at line 336 of file PlotLogger.h.
Referenced by casa::PlotMSIndexer::logInfo(), and casa::PlotMSCacheBase::logInfo().
|
static |
Definition at line 337 of file PlotLogger.h.
Referenced by casa::PlotMSIndexer::logWarn(), and casa::PlotMSCacheBase::logWarn().
|
static |
No events.
Definition at line 361 of file PlotLogger.h.
|
static |
Creation/deletion of major objects.
Definition at line 354 of file PlotLogger.h.