LRAUV  revA
SyslogEntry Class Reference

LogEntry with information specific to "Syslog"-like text logs. More...

#include <SyslogEntry.h>

Inheritance diagram for SyslogEntry:
Collaboration diagram for SyslogEntry:

Classes

class  StaticDestructor
 Makes sure that mallocRing_s is deleted on shutdown. More...
 

Public Member Functions

 SyslogEntry (const Str &inMsg, Syslog::Severity sev, const CodedStr &loggerFacility, const Timestamp &timestamp=Timestamp::NOT_SET_TIME)
 Constructor, initialized from a Str. More...
 
 SyslogEntry (const SyslogEntry &syslogEntry)
 Copy Constructor. More...
 
virtual ~SyslogEntry ()
 Destructor. More...
 
void * operator new (size_t size)
 Override new. More...
 
void operator delete (void *p)
 Override delete. More...
 
virtual unsigned int write (Timestamp &timeBase, OutStream &logStream) const
 Send payload to a stream. More...
 
virtual Str toString (const Unit *unit=NULL) const
 Convert payload to Str. More...
 
virtual Str toKmlString (const Unit *unit=NULL) const
 Return Str. More...
 
const StrgetMessage (void) const
 Get the message. More...
 
Syslog::Severity getSeverity (void) const
 Return the severity. More...
 
const CodedStrgetLoggerFacility (void) const
 
- Public Member Functions inherited from LogEntry
virtual ~LogEntry ()
 Destructor. More...
 
const TimestampgetTimestamp (void) const
 Accessors. More...
 
const TimestampsetTimestamp (const Timestamp &newTime)
 
const TimestampsetTimestamp (const double newTime)
 
Type getType (void) const
 

Static Public Member Functions

static SyslogEntryRead (Timestamp &timeBase, Timespan &timeAdjust, InStream &inStream, unsigned short firstWord, Logger &logger)
 Read new SyslogEntry from a stream. More...
 
- Static Public Member Functions inherited from LogEntry
static LogEntryRead (Timestamp &timeBase, Timespan &timeAdjust, InStream &inStream, Logger &logger)
 Read in a new entry from a stream. More...
 
static const char * TypeToString (Type theType)
 Convert types to Strs. More...
 

Private Attributes

Str message_
 The stored freetext message. More...
 
Syslog::Severity severity_
 
const CodedStrloggerFacility_
 

Static Private Attributes

static RingBufferVoidMallocRing_
 Declared as a pointer to avoid including RingBuffer.h header here. More...
 
static SyslogEntry::StaticDestructor StaticDestructor_
 Static instance of StaticDestructor. More...
 

Additional Inherited Members

- Public Types inherited from LogEntry
enum  Type {
  NOT_LOG_ENTRY = -1, EVENT_LOG_ENTRY = 0, DIRECTORY_LOG_ENTRY = 1, DATA_LOG_ENTRY = 2,
  SYSLOG_LOG_ENTRY = 3
}
 Defines an enum for "typing" the various LogEntries. More...
 
- Static Public Attributes inherited from LogEntry
static const int TYPE_MASK = 0x0003
 
- Protected Member Functions inherited from LogEntry
 LogEntry (Type myType, const Timestamp &timestamp=Timestamp::NOT_SET_TIME)
 Constructor. More...
 
unsigned int writeTimestamp (const Timestamp &timeBase, bool changed, OutStream &logStream, Logger::TimePrecisionType timePrecision) const
 
- Static Protected Member Functions inherited from LogEntry
static bool ReadTimestamp (Timestamp &timestamp, bool &changed, InStream &inStream, Logger &logger, Logger::TimePrecisionType timePrecision)
 
- Protected Attributes inherited from LogEntry
Type type_
 Stores the type of a given LogEntry. More...
 
Timestamp timestamp_
 
- Static Protected Attributes inherited from LogEntry
static const Str UNKNOWN
 

Detailed Description

LogEntry with information specific to "Syslog"-like text logs.

A Syslog::Severity value is associated with each text entry, indicating its importance. Severities include:

A SyslogEntry is serialized as:

  • a 16-bit header (serialized using OutStream::writeUShortCompact) including:
    • 12 high bits: Actor code (which can be used to look up what code unit is writing to the log)
    • 2 bits: Syslog::Severity code, indicating the severity of the message being logged: from debug messages to messages that must be relayed to shore via satellite.
    • 2 bits: the value 2, indicating this is a SyslogEntry
  • 64-bit Timespan as integer microseconds since the previous LogEntry, serialized using OutStream::writeLongLongCompact.
  • 16-bit integer length of the character sequence that follows, serialized using OutStream::writeUShortCompact
  • the characters of the message, with no termination character.

Constructor & Destructor Documentation

SyslogEntry::SyslogEntry ( const Str inMsg,
Syslog::Severity  sev,
const CodedStr loggerFacility,
const Timestamp timestamp = Timestamp::NOT_SET_TIME 
)

Constructor, initialized from a Str.

Referenced by Read().

SyslogEntry::SyslogEntry ( const SyslogEntry syslogEntry)

Copy Constructor.

SyslogEntry::~SyslogEntry ( )
virtual

Destructor.

Member Function Documentation

const Str& SyslogEntry::getMessage ( void  ) const
inline

Get the message.

References message_.

Referenced by SyslogStartRule::check(), MostRecentLogWriter::write(), and write().

Syslog::Severity SyslogEntry::getSeverity ( void  ) const
inline

Return the severity.

References severity_.

Referenced by SyslogSeverityRule::check(), Logger::log(), and MostRecentLogWriter::write().

void SyslogEntry::operator delete ( void *  p)

Override delete.

void * SyslogEntry::operator new ( size_t  size)

Override new.

Str SyslogEntry::toKmlString ( const Unit unit = NULL) const
virtual
Str SyslogEntry::toString ( const Unit unit = NULL) const
virtual

Member Data Documentation

const CodedStr& SyslogEntry::loggerFacility_
private
RingBufferVoid * SyslogEntry::MallocRing_
staticprivate

Declared as a pointer to avoid including RingBuffer.h header here.

Referenced by SyslogEntry::StaticDestructor::~StaticDestructor().

Str SyslogEntry::message_
private

The stored freetext message.

Referenced by getMessage(), toKmlString(), and toString().

Syslog::Severity SyslogEntry::severity_
private

Referenced by getSeverity(), toString(), and write().

SyslogEntry::StaticDestructor SyslogEntry::StaticDestructor_
staticprivate

Static instance of StaticDestructor.


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