Classes | Public Types | Public Member Functions | Static Public Member Functions
Tonido::Util::ErrorLog Class Reference

Serializable binary dump error container. More...

List of all members.

Classes

class  ErrorRecord
 ErrorRecord that stores a single dump. More...

Public Types

typedef boost::shared_ptr
< ErrorLog
SharedPtr

Public Member Functions

 ErrorLog ()
 Default contructor.
 ErrorLog (ErrorLog &a_errorLog)
 Copy constructor.
 ErrorLog (const std::string &a_primaryReason, const std::string &a_details)
 Constructor to initialize header.
 ErrorLog (uint8_bt *a_buffer, uint32_bt a_buflen)
 Constructor for un-serialization.
 ~ErrorLog ()
 Destructor.
void flatten (Data::RawData::SharedPtr &a_data)
 Serialize errorlog into a buffer.
ErrorLogoperator= (ErrorLog &a_errorLog)
 Assignment operator.
void addErrorRecord (const std::string &a_message, const std::string &a_details, void *a_dataBuffer, uint32_bt a_bufferLength, uint32_bt a_parserId=0)
 Add Error Record.
const std::string & getReason (void) const
 Return the reason of this log.
void setReason (const std::string &a_reasonCode)
 Sets the reason of this log.
const std::string & getDetails (void) const
 Return the details of this log.
void setDetails (const std::string &a_details)
 Set the details of this log.
uint32_bt logId (void) const
 Errorlog identifier.
uint32_bt getLogLength (void)
 Calculates size of Error Log for serialization.
void commit (const std::string &a_logDirectory)
 Write log to persistent storage.
void purgeErrorLogs (const std::string &a_logDirectory)
 Cleans the given directory and removes old ErrorLogs as needed.
bool isCommitted (void) const
 Determine if the log has been commited.
std::vector
< ErrorRecord::SharedPtr > & 
getErrorRecordsVector (void)
 Return reference to vector containing the error records.
Poco::DateTime getCreationTime (void)
 getCreationTime
Poco::DateTime getCommittedTime (void)
 getCommittedTime

Static Public Member Functions

static void cleanErrorLogs (const std::string &a_logDirectory)

Detailed Description

Serializable binary dump error container.


Constructor & Destructor Documentation

Tonido::Util::ErrorLog::ErrorLog ( )

Default contructor.

Just create object with no data

Tonido::Util::ErrorLog::ErrorLog ( ErrorLog a_errorLog)

Copy constructor.

Create a new object from another message object

Tonido::Util::ErrorLog::ErrorLog ( const std::string &  a_primaryReason,
const std::string &  a_details 
)

Constructor to initialize header.

Create a new errorlog

Parameters:
a_primaryReason - primary reason this error log is being created
a_details - More details about the error
Tonido::Util::ErrorLog::ErrorLog ( uint8_bt *  a_buffer,
uint32_bt  a_buflen 
)

Constructor for un-serialization.

Create an ErrorLog object from a serialized buffer


Member Function Documentation

void Tonido::Util::ErrorLog::addErrorRecord ( const std::string &  a_message,
const std::string &  a_details,
void *  a_dataBuffer,
uint32_bt  a_bufferLength,
uint32_bt  a_parserId = 0 
)

Add Error Record.

This method will add a buffer to the errorlog.

Parameters:
[in]a_message- message associated with this error record
[in]a_detailsdetails associated with this error record
[in]a_dataBufferPointer to buffer to be added
[in]a_bufferLengthSize of data to be added
[in]a_parserId- User supplied id that can be later used by a user supplied parser to format the stored data.
Poco::DateTime Tonido::Util::ErrorLog::getCommittedTime ( void  )

getCommittedTime

Get the log committed time. This has any meaning only when the log is committed. Else this is same as creation time

Poco::DateTime Tonido::Util::ErrorLog::getCreationTime ( void  )

getCreationTime

Get the log creation time

bool Tonido::Util::ErrorLog::isCommitted ( void  ) const

Determine if the log has been commited.

Return whether or not commit operation has been done in which case, this log can be deleted to prevent multiple logs for the same problem.

uint32_bt Tonido::Util::ErrorLog::logId ( void  ) const

Errorlog identifier.

Retrieve the unique identifier of this log

ErrorLog & Tonido::Util::ErrorLog::operator= ( ErrorLog a_errorLog)

Assignment operator.

The errorlog passed in will be replicated and the a reference will be returned


Generated on Wed Oct 12 2011 21:46:54. © CodeLathe LLC 2007-2011. All Rights Reserved.