TableLogSink.h
Classes
- TableLogSink -- Save log messages in an AIPS++ Table (full description)
Types
- TIME
-
MJD in seconds, UT. (Double.)
- PRIORITY
-
Message importance. (String).
- MESSAGE
-
Informational message. (String).
- LOCATION
-
Source code origin of the log message. Usually a combination of
class name, method name, file name and line number, but any String
is legal.
- OBJECT_ID
-
ObjectID of distributed object that created the message (String).
If empty, no OBJECT_ID was set.
Interface
- Public Members
- TableLogSink (LogMessage::Priority filter, const String& fileName, Bool useSSM=True)
- TableLogSink (const LogFilterInterface& filter, const String& fileName, Bool useSSM=True)
- explicit TableLogSink (const String& fileName)
- TableLogSink (const TableLogSink& other)
- TableLogSink& operator= (const TableLogSink& other)
- ~TableLogSink()
- void reopenRW (const LogFilterInterface& filter)
- virtual Bool postLocally (const LogMessage& message)
- virtual uInt nelements() const
- virtual Double getTime (uInt i) const
- virtual String getPriority (uInt i) const
- virtual String getMessage (uInt i) const
- virtual String getLocation (uInt i) const
- virtual String getObjectID (uInt i) const
- const Table& table() const
- Table& table()
- const ROScalarColumn<Double>& roTime() const
- ScalarColumn<Double>& time()
- const ROScalarColumn<String>& roPriority() const
- ScalarColumn<String>& priority()
- const ROScalarColumn<String>& roMessage() const
- ScalarColumn<String>& message()
- const ROScalarColumn<String>& roLocation() const
- ScalarColumn<String>& location()
- const ROScalarColumn<String>& roObjectID() const
- ScalarColumn<String>& objectID()
- static String columnName(Columns which)
- static TableDesc logTableDescription()
- virtual void flush (Bool global=True)
- virtual void writeLocally (Double time, const String& message, const String& priority, const String& location, const String& objectID)
- virtual void clearLocally()
- static String localId( )
- String id( ) const
- static LogSink makeSink (const String& fileName)
- static LogSink makeSink (LogMessage::Priority filter, const String& fileName)
- static LogSink makeSink (const LogFilterInterface& filter, const String& fileName)
- Private Members
- TableLogSink()
- void copy_other(const TableLogSink& other)
- void makeTable (SetupNewTable&, Bool useSSM)
- void attachCols()
- void init (const String& fileName, Bool useSSM)
Review Status
- Reviewed By:
- wbrouw
- Date Reviewed:
- 1996/08/21
- Programs:
- Demos:
- Tests:
Prerequisite
Etymology
Log to an AIPS++ Table.
Synopsis
Unlike the other classes derived from
LogSinkInterface, there are utility
functions in this class which might be of some modest interest. In
particular, the member functions which define the structure of the table
and define the column names might be of interest.
This class posts messages which pass the filter to an AIPS++
Table. It puts ever field of the
LogMessage into its own column.
Example
See Logging.h.
Motivation
"Persistent" log messages must be stored in a Table.
To Do
- Allow a subset of the columns to be written? e.g., only time,
message, and priority.
- Allow time sorting in concatenate?
Member Description
TableLogSink (LogMessage::Priority filter, const String& fileName, Bool useSSM=True)
TableLogSink (const LogFilterInterface& filter, const String& fileName, Bool useSSM=True)
If fileName exists, attach and append to it, otherwise create
a table with that name. If the table exists, it must have all the
required columns defined by logTableDescription().
The useSSM is a temmporary fix to make it possible
to use the old StManAipsIO storage manager for a log table.
It is used by PagedImage to make it possible to access release 1.4
images with release 1.3 software.
explicit TableLogSink (const String& fileName)
Open the log table for readonly.
If needed, reopenRW can be used later to define a filter and
to open the logtable for writing.
TableLogSink (const TableLogSink& other)
TableLogSink& operator= (const TableLogSink& other)
After copying, both sinks will write to the same Table.
void reopenRW (const LogFilterInterface& filter)
Reopen the logtable for read/write (if needed).
When it actually reopens, the given filter will be used.
If the message passes the filter, write it to the log table.
virtual uInt nelements() const
Get number of messages in sink.
Get given part of the i-th message from the sink.
Defines the minimal set of columns in the table (more may exist, but
are ignored.
Access to the actual log table and its columns.
Functions time, priority, message, location, objectID
return a null ScalarColumn object when the logtable is
not writable. Using it may result in using a null pointer
causing a core dump. In debug mode it is checked if the object
is not null.
Turn the Columns enum into a String which is the actual
column name in the Table.
Description of the log table. You can use this if, e.g., you do not
want to use the storage managers that this class creates by default
(currently Miriad).
virtual void flush (Bool global=True)
Write out any pending output to the table.
virtual void writeLocally (Double time, const String& message, const String& priority, const String& location, const String& objectID)
Write a message (usually from another logsink) into the local one.
Clear the local sink (i.e. remove all messages from it).
Returns the id for this class...
Returns the id of the LogSink in use...
static LogSink makeSink (const String& fileName)
static LogSink makeSink (LogMessage::Priority filter, const String& fileName)
static LogSink makeSink (const LogFilterInterface& filter, const String& fileName)
Make a LogSink for a TableLogSink with a new table.
Default filter is NORMAL.
Undefined and inaccessible
void copy_other(const TableLogSink& other)
Avoid duplicating code in copy ctor and assignment operator
Make a new log table.
Attach the column objects and create unit keywor if needed.
void init (const String& fileName, Bool useSSM)
Initialize the object.