casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes
casa::PlotLogger Class Reference

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>

List of all members.

Public Member Functions

 PlotLogger (Plotter *plotter, int filterEventFlags=NO_EVENTS, LogMessage::Priority filterMinPriority=LogMessage::DEBUGGING)
 Non-Static //.
virtual ~PlotLogger ()
 Destructor.
CountedPtr< LogSinkInterfacesink ()
 Log IO Methods //.
const CountedPtr
< LogSinkInterface
sink () const
LogSinkInterfacelocalSinkCopy () const
 Gets a copy of the log sink interface, IF it is not the global.
const StringsinkLocation () const
 Gets/Sets the log sink file location.
void setSinkLocation (const String &logFile)
bool usingGlobalSink () const
 Returns true if the logger is currently using the global sink, false otherwise.
LogMessage::Priority filterMinPriority () const
 Filtering Methods //.
void setFilterMinPriority (PlotLogMessage::Priority minPriority)
bool filterEventFlag (int flag) const
 Gets/Sets the log filter event flag for a single event type.
void setFilterEventFlag (int flag, bool on)
int filterEventFlags () const
 Gets/Sets the log filter event flag(s).
void setFilterEventFlags (int flags)
void postMessage (const PlotLogMessage &message)
 Message Methods //.
void postMessage (const String &origin1, const String &origin2, const String &message, int eventType=PlotLogMessage::DEFAULT_EVENT_TYPE)
PlotLogMessage markMeasurement (const String &origin1, const String &origin2, int eventType=PlotLogMessage::DEFAULT_EVENT_TYPE, bool postStartMessage=true)
 Measurement Methods //.
PlotLogMeasurement releaseMeasurement (bool postReleaseMessage=true)
 Gets the measurement since the last mark.
PlotLogLocate locate (PlotCanvas *canvas, const PlotRegion &region, int eventType=MSG_INFO, bool postLocateMessage=true)
 Locate Methods //.

Static Public Member Functions

static int ALL_EVENTS_FLAG ()
 All events as a flag.
static vector< int > ALL_EVENTS ()
 All events as a vector.
static int REGISTER_EVENT_TYPE (const String &name, LogMessage::Priority priority=LogMessage::NORMAL)
 Registers an extended event type with the given name and optional priority and returns its value.
static void UNREGISTER_EVENT_TYPE (int event)
 Unregisters the given extended event type.
static void UNREGISTER_EVENT_TYPE (const String &name)
static vector< StringEVENT_NAMES ()
 Returns all the event names.
static String EVENT (int type)
 Converts between an event type and its name.
static int EVENT (const String &name)
static int FLAG_FROM_EVENTS (const vector< int > &events)
 Returns an event flag from the given vector.
static int FLAG_FROM_EVENTS (const vector< String > &names)
static int FLAG_FROM_PRIORITY (LogMessage::Priority minPriority)
 Returns an event flag for all events that meet the given minimum priority.
static LogMessage::Priority EVENT_PRIORITY (int event)
 Gets/Sets the message priority for the given log event.
static void SET_EVENT_PRIORITY (int event, LogMessage::Priority priority)
static void disableGlobalSink ()
 Disables the global sink until enableGlobalSink() is called.
static void enableGlobalSink ()
 Re-enables the global sink.

Static Public Attributes

static const int MSG_INFO
 Static //.
static const int MSG_WARN
static const int MSG_ERROR
static const int MSG_DEBUG
 Miscellaneous debugging messages.
static const int DRAW_TOTAL
 Replotting/redrawing the whole GUI.
static const int DRAW_INDIVIDUAL
 Replotting/redrawing each plot item.
static const int METHODS_MAJOR
 Entering/exiting major methods.
static const int OBJECTS_MAJOR
 Creation/deletion of major objects.
static const int EXPORT_TOTAL
 Exporting canvases to file.
static const int NO_EVENTS
 No events.

Private Attributes

Plotterm_plotter
 Plotter.
CountedPtr< LogSinkInterfacem_logger
 Log sink.
PlotLoggerFilter m_filter
 Log filter.
String m_loggerLocation
 Log sink location.
vector< PlotLogMeasurementm_measurements
 Current measurement marks.

Static Private Attributes

static vector< int > EXTENDED_TYPES
 Static //.
static vector< StringEXTENDED_NAMES
 Registered extended type names.
static map< int,
LogMessage::Priority
EVENT_PRIORITIES
 Map from log event to priority.
static LogFilterInterfaceDISABLED_GLOBAL_FILTER
 Disabled old global filter, or null.

Detailed Description

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 331 of file PlotLogger.h.


Constructor & Destructor Documentation

casa::PlotLogger::PlotLogger ( Plotter plotter,
int  filterEventFlags = NO_EVENTS,
LogMessage::Priority  filterMinPriority = 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 casa::PlotLogger::~PlotLogger ( ) [virtual]

Destructor.


Member Function Documentation

static vector<int> casa::PlotLogger::ALL_EVENTS ( ) [static]

All events as a vector.

static int casa::PlotLogger::ALL_EVENTS_FLAG ( ) [static]

All events as a flag.

static void casa::PlotLogger::disableGlobalSink ( ) [static]

Disables the global sink until enableGlobalSink() is called.

Can be used when something posts undesirably to both the local and global logs.

static void casa::PlotLogger::enableGlobalSink ( ) [static]

Re-enables the global sink.

See disableGlobalSink().

static String casa::PlotLogger::EVENT ( int  type) [static]

Converts between an event type and its name.

static int casa::PlotLogger::EVENT ( const String name) [static]
static vector<String> casa::PlotLogger::EVENT_NAMES ( ) [static]

Returns all the event names.

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.

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.

Filtering Methods //.

Gets/Sets the log filter priority level.

static int casa::PlotLogger::FLAG_FROM_EVENTS ( const vector< int > &  events) [static]

Returns an event flag from the given vector.

static int casa::PlotLogger::FLAG_FROM_EVENTS ( const vector< String > &  names) [static]
static int casa::PlotLogger::FLAG_FROM_PRIORITY ( LogMessage::Priority  minPriority) [static]

Returns an event flag for all events that meet the given minimum priority.

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 String origin1,
const 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 String origin1,
const String origin2,
const String message,
int  eventType = PlotLogMessage::DEFAULT_EVENT_TYPE 
)
static int casa::PlotLogger::REGISTER_EVENT_TYPE ( const String name,
LogMessage::Priority  priority = LogMessage::NORMAL 
) [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::SET_EVENT_PRIORITY ( int  event,
LogMessage::Priority  priority 
) [static]
void casa::PlotLogger::setFilterEventFlag ( int  flag,
bool  on 
)
void casa::PlotLogger::setSinkLocation ( const String logFile)

Log IO Methods //.

Gets the log sink interface.

Gets/Sets the log sink file location.

If the filename is empty, it means the global sink.

static void casa::PlotLogger::UNREGISTER_EVENT_TYPE ( int  event) [static]

Unregisters the given extended event type.

If a priority has been set, it is NOT removed.

static void casa::PlotLogger::UNREGISTER_EVENT_TYPE ( const String name) [static]
bool casa::PlotLogger::usingGlobalSink ( ) const [inline]

Returns true if the logger is currently using the global sink, false otherwise.

Definition at line 452 of file PlotLogger.h.


Member Data Documentation

Disabled old global filter, or null.

Definition at line 538 of file PlotLogger.h.

Replotting/redrawing each plot item.

Definition at line 351 of file PlotLogger.h.

const int casa::PlotLogger::DRAW_TOTAL [static]

Replotting/redrawing the whole GUI.

Definition at line 348 of file PlotLogger.h.

Map from log event to priority.

Definition at line 535 of file PlotLogger.h.

const int casa::PlotLogger::EXPORT_TOTAL [static]

Exporting canvases to file.

Definition at line 360 of file PlotLogger.h.

vector<String> casa::PlotLogger::EXTENDED_NAMES [static, private]

Registered extended type names.

Definition at line 532 of file PlotLogger.h.

vector<int> casa::PlotLogger::EXTENDED_TYPES [static, private]

Static //.

Registered extended types.

Definition at line 529 of file PlotLogger.h.

Log filter.

Definition at line 517 of file PlotLogger.h.

Log sink.

Definition at line 514 of file PlotLogger.h.

Log sink location.

Definition at line 520 of file PlotLogger.h.

Current measurement marks.

Definition at line 523 of file PlotLogger.h.

Plotter.

Definition at line 511 of file PlotLogger.h.

const int casa::PlotLogger::METHODS_MAJOR [static]

Entering/exiting major methods.

Definition at line 354 of file PlotLogger.h.

const int casa::PlotLogger::MSG_DEBUG [static]

Miscellaneous debugging messages.

Definition at line 345 of file PlotLogger.h.

Referenced by casa::PlotMSIndexer::logDebug(), and casa::PlotMSCacheBase::logDebug().

const int casa::PlotLogger::MSG_ERROR [static]

Definition at line 341 of file PlotLogger.h.

Referenced by casa::PlotMSIndexer::logError(), and casa::PlotMSCacheBase::logError().

const int casa::PlotLogger::MSG_INFO [static]

Static //.

Event types //

Event types that are always allowed.

Definition at line 339 of file PlotLogger.h.

Referenced by casa::PlotMSIndexer::logInfo(), and casa::PlotMSCacheBase::logInfo().

const int casa::PlotLogger::MSG_WARN [static]

Definition at line 340 of file PlotLogger.h.

Referenced by casa::PlotMSIndexer::logWarn(), and casa::PlotMSCacheBase::logWarn().

const int casa::PlotLogger::NO_EVENTS [static]

No events.

Definition at line 364 of file PlotLogger.h.

const int casa::PlotLogger::OBJECTS_MAJOR [static]

Creation/deletion of major objects.

Definition at line 357 of file PlotLogger.h.


The documentation for this class was generated from the following file: