casacore
|
#include <LogMessage.h>
Public Types | |
enum | Priority { DEBUGGING , DEBUG2 , DEBUG1 , NORMAL5 , NORMAL4 , NORMAL3 , NORMAL2 , NORMAL1 , NORMAL , WARN , SEVERE } |
An "importance" which is assigned to each LogMessage. More... | |
Public Member Functions | |
LogMessage (Priority priority=NORMAL) | |
Create a message with the given priority and the current time, and an empty origin and message. More... | |
LogMessage (const LogOrigin &sourceLocation, Priority priority=NORMAL) | |
Create a message with the given location and priority, the current time and an empty message. More... | |
LogMessage (const String &message, const LogOrigin &sourceLocation, Priority=NORMAL) | |
Create a completely filled out LogMessage. More... | |
LogMessage (const LogMessage &other) | |
Make this LogMessage a copy of other . More... | |
LogMessage & | operator= (const LogMessage &other) |
~LogMessage () | |
const String & | message () const |
Get the message text. More... | |
LogMessage & | message (const String &message, Bool keepLastTime=False) |
Set the message text. More... | |
uInt | line () const |
Get and set the line number in the LogOrigin. More... | |
LogMessage & | line (uInt which) |
LogMessage & | sourceLocation (const SourceLocation *where) |
Set the source location - usually this will be called with the macro WHERE. More... | |
const LogOrigin & | origin () const |
Get and set the origin of this LogMessage. More... | |
LogMessage & | origin (const LogOrigin &origin) |
Priority | priority () const |
Get or change the priority of this LogMessage. More... | |
LogMessage & | priority (Priority which) |
const Time & | messageTime () const |
Returns the time at which the message text was created. More... | |
LogMessage & | messageTime (const Time &theTime) |
Normally you should not manually set the time, however there may be rare circumstances where it is useful - for example if you have a single static message that you want to send out at various times. More... | |
String | toString () const |
Turn this entire LogMessage into a String. More... | |
String | toTermString () const |
Static Public Member Functions | |
static const String & | toString (Priority which) |
Map the given priority into a String - so, for example, it can be stored in a table. More... | |
Private Member Functions | |
void | copy_other (const LogMessage &other) |
Provide common implementation for copy constructor and assignment operator. More... | |
Private Attributes | |
String | message_p |
LogOrigin | origin_p |
Priority | priority_p |
Time | time_p |
Informational log messages with with time, priority, and origin.
Public interface
A LogMessage
is the unit of information in the Logging system. A LogMessage consists of an informational text (String) message tagged with the following:
DEBUGGING
, NORMAL
, WARN
, or SEVERE
. A more complete example is available in the module file Logging.h.
MessageType
enum to go along with Priority
. It was removed because the categories weren't sufficiently orthogonal. However the idea is probably sound and we might eventually want to put such a categorization back. Definition at line 101 of file LogMessage.h.
An "importance" which is assigned to each LogMessage.
Definition at line 105 of file LogMessage.h.
Create a message with the given priority and the current time, and an empty origin and message.
Create a message with the given location and priority, the current time and an empty message.
This will likely be the most commonly used constructor when a given message is to be used several times in the same function.
casacore::LogMessage::LogMessage | ( | const String & | message, |
const LogOrigin & | sourceLocation, | ||
Priority | = NORMAL |
||
) |
Create a completely filled out LogMessage.
casacore::LogMessage::LogMessage | ( | const LogMessage & | other | ) |
Make this
LogMessage a copy of other
.
Note that the time is also copied over.
casacore::LogMessage::~LogMessage | ( | ) |
|
private |
Provide common implementation for copy constructor and assignment operator.
uInt casacore::LogMessage::line | ( | ) | const |
Get and set the line number in the LogOrigin.
While in principle you can get and set this information through the origin()
functions, in practice it is convenient to be able to directly get at the line number since it and the message text are usually the only things you change in a particular LogMessage object. Generally you will set the line number with the LINE
macro.
LogMessage& casacore::LogMessage::line | ( | uInt | which | ) |
const String& casacore::LogMessage::message | ( | ) | const |
Get the message text.
LogMessage& casacore::LogMessage::message | ( | const String & | message, |
Bool | keepLastTime = False |
||
) |
Set the message text.
If keepLastTime
is True
, the previous time will be used, otherwise the current time is used. This is intended for messages that come out at essentially identical times to aid in, e.g., Table selections.
const Time& casacore::LogMessage::messageTime | ( | ) | const |
Returns the time at which the message text was created.
This time is presently "computer operating system" precision time, not high-precision astronomical time.
LogMessage& casacore::LogMessage::messageTime | ( | const Time & | theTime | ) |
Normally you should not manually set the time, however there may be rare circumstances where it is useful - for example if you have a single static
message that you want to send out at various times.
LogMessage& casacore::LogMessage::operator= | ( | const LogMessage & | other | ) |
const LogOrigin& casacore::LogMessage::origin | ( | ) | const |
Get and set the origin of this LogMessage.
If you only need the line number, use the line()
or sourceOrigin()
functions instead.
LogMessage& casacore::LogMessage::origin | ( | const LogOrigin & | origin | ) |
Priority casacore::LogMessage::priority | ( | ) | const |
Get or change the priority of this LogMessage.
LogMessage& casacore::LogMessage::priority | ( | Priority | which | ) |
LogMessage& casacore::LogMessage::sourceLocation | ( | const SourceLocation * | where | ) |
Set the source location - usually this will be called with the macro WHERE.
String casacore::LogMessage::toString | ( | ) | const |
Turn this entire LogMessage into a String.
String casacore::LogMessage::toTermString | ( | ) | const |
|
private |
Definition at line 208 of file LogMessage.h.
|
private |
Definition at line 209 of file LogMessage.h.
|
private |
Definition at line 210 of file LogMessage.h.
|
private |
Definition at line 211 of file LogMessage.h.