LRAUV  revA
SyslogEntry.h
Go to the documentation of this file.
1 
11 #ifndef SYSLOGENTRY_H_
12 #define SYSLOGENTRY_H_
13 
14 #include "utils/Str.h"
15 
16 #include "LogEntry.h"
17 #include "Syslog.h"
18 
22 
23 class CodedStr;
24 class RingBufferVoid;
25 
54 class SyslogEntry : public LogEntry
55 {
56 public:
58  SyslogEntry( const Str &inMsg, Syslog::Severity sev, const CodedStr& loggerFacility,
59  const Timestamp& timestamp = Timestamp::NOT_SET_TIME );
60 
62  SyslogEntry( const SyslogEntry& syslogEntry );
63 
65  virtual ~SyslogEntry();
66 
68  void* operator new( size_t size );
69 
71  void operator delete( void* p );
72 
78  static SyslogEntry* Read( Timestamp& timeBase, Timespan& timeAdjust, InStream &inStream, unsigned short firstWord, Logger& logger );
79 
85  virtual unsigned int write( Timestamp& timeBase, OutStream& logStream ) const;
86 
87  // Convert payload to Str
88  virtual Str toString( const Unit* unit = NULL ) const;
89 
90  // Convert payload to simple Str for inclusion in a Kml file.
91  virtual Str toKmlString( const Unit* unit = NULL ) const;
92 
94  const Str &getMessage( void ) const
95  {
96  return message_;
97  };
98 
101  {
102  return severity_;
103  };
104 
105  const CodedStr& getLoggerFacility( void ) const
106  {
107  return loggerFacility_;
108  }
109 
110 private:
111 
116 
119 
122  {
123  public:
125  };
126 
129 
130 };
131 
132 #endif /*SYSLOGENTRY_H_*/
Client-side interface for injecting log data into the log queue.
Definition: Logger.h:30
static SyslogEntry::StaticDestructor StaticDestructor_
Static instance of StaticDestructor.
Definition: SyslogEntry.h:128
virtual Str toString(const Unit *unit=NULL) const
Convert payload to Str.
Definition: SyslogEntry.cpp:175
~StaticDestructor()
Definition: SyslogEntry.cpp:23
Makes sure that mallocRing_s is deleted on shutdown.
Definition: SyslogEntry.h:121
Timespan class, represents a delta of time.
Definition: Timestamp.h:248
const CodedStr & loggerFacility_
Definition: SyslogEntry.h:115
Contains the Syslog class definition.
This is a very abstract class that can be implemented by classes that want to receive stream input...
Definition: InStream.h:29
One "entry" in a LogQueue.
Definition: LogEntry.h:33
Extends the Str class, adding an unsigned short code (actually, the codes are limited to 14 bits...
Definition: CodedStr.h:23
LogEntry with information specific to "Syslog"-like text logs.
Definition: SyslogEntry.h:54
Contains the LogEntry class definition.
static const Timestamp NOT_SET_TIME
Constant value to represent "no time".
Definition: Timestamp.h:37
Replacement for standard template class string.
Definition: Str.h:12
SyslogEntry(const Str &inMsg, Syslog::Severity sev, const CodedStr &loggerFacility, const Timestamp &timestamp=Timestamp::NOT_SET_TIME)
Constructor, initialized from a Str.
Definition: SyslogEntry.cpp:29
const Str & getMessage(void) const
Get the message.
Definition: SyslogEntry.h:94
virtual ~SyslogEntry()
Destructor.
Definition: SyslogEntry.cpp:45
Syslog::Severity severity_
Definition: SyslogEntry.h:114
static RingBufferVoid * MallocRing_
Declared as a pointer to avoid including RingBuffer.h header here.
Definition: SyslogEntry.h:118
Severity
An attempt to define different levels of syslog severity.
Definition: Syslog.h:28
This is a very abstract class that can be implemented by classes that want to send stream output...
Definition: OutStream.h:41
Syslog::Severity getSeverity(void) const
Return the severity.
Definition: SyslogEntry.h:100
Str message_
The stored freetext message.
Definition: SyslogEntry.h:113
const CodedStr & getLoggerFacility(void) const
Definition: SyslogEntry.h:105
Thread-safe ring buffer for storing void pointers.
Definition: RingBuffer.h:36
virtual Str toKmlString(const Unit *unit=NULL) const
Return Str.
Definition: SyslogEntry.cpp:170
Code that represents an engineering unit.
Definition: Unit.h:24
virtual unsigned int write(Timestamp &timeBase, OutStream &logStream) const
Send payload to a stream.
Definition: SyslogEntry.cpp:138
Represents absolute times.
Definition: Timestamp.h:31
static SyslogEntry * Read(Timestamp &timeBase, Timespan &timeAdjust, InStream &inStream, unsigned short firstWord, Logger &logger)
Read new SyslogEntry from a stream.
Definition: SyslogEntry.cpp:77