Class SBCLogEvent#
Log handling. More...
#include "SBCLogEvent.hpp"
Public Types#
Type | Name |
---|---|
enum | Type Available log event types. |
Public Functions#
Type | Name |
---|---|
SBCLogEvent (SBCLogEvent::Type eventLevel, const std::string & filename, const std::string & functionName, const std::string & lineNumber, const std::string & descriptionMessage, const std::string & uuid="BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB") Constructor. |
|
SBCLogEvent () Default constructor. |
|
const std::string & | getDescriptionMessage () Returns message that describe the event. |
const std::string & | getFileLine () Returns line number where event is recorded. |
const std::string & | getFilename () Returns fileName where event is recorded. |
const std::string & | getFunctionName () Returns function name where event is recorded. |
const std::string & | getLibraryUUID () Returns uuid of library where event is recorded. |
const std::string & | getTime () Returns event date. |
Type | getType () Returns event type. |
size_t | hash () const Returns the hash of the event. |
virtual bool | isSerializable () const Returns true __ |
virtual void | serialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) const Serializes the logEvent. |
void | setDescriptionMessage (const std::string & message) Sets a message describing the event. |
void | setFileLine (const std::string & line) Sets line number where event is recorded. |
void | setFilename (const std::string & name) Sets fileName where event is recorded. |
void | setFunctionName (const std::string & name) Sets function name where event is recorded. |
void | setLibraryUUID (const std::string & name) Sets uuid of library where event is recorded. |
void | setTime (const std::string & date) Sets event date. |
void | setType (Type level) Sets event type. |
std::string | toString (bool printTime=true, bool printLocation=true) const Returns event formatted the following way: YYYY-MM-D_HH-MM-SS-mmm depending on the print options given as input. |
virtual void | unserialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) Unserializes the logEvent. |
virtual | ~SBCLogEvent () Destructor. |
Public Static Functions#
Type | Name |
---|---|
std::string | getPublicTypeString (SBCLogEvent::Type e) Returns the public string representation of the given SBCLogEvent::Type . |
SBCLogEvent::Type | getTypeFromString (const std::string & typeString) Returns the SBCLogEvent::Type from the given string. |
std::string | getTypeString (SBCLogEvent::Type e) Returns the string representation of the given SBCLogEvent::Type . |
std::string | hideFilePaths (const std::string & input) Hides the file path from the input for privacy. |
Detailed Description#
Every program needs to report/handle log conditions. This is done by managing an event stack where messages, with helpful runtime information, are put. A SBCLogEvent represent a logging event. An event is made up a date, a location (File / Line), a level and a description message
Public Types Documentation#
enum Type#
Available log event types.
enum SBCLogEvent::Type {
Analytics = 5,
StackHistory = 4,
Trace = 3,
Information = 2,
Warning = 1,
Error = 0
};
Public Functions Documentation#
function SBCLogEvent [1/2]#
Constructor.
SBCLogEvent::SBCLogEvent (
SBCLogEvent::Type eventLevel,
const std::string & filename,
const std::string & functionName,
const std::string & lineNumber,
const std::string & descriptionMessage,
const std::string & uuid="BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB"
)
function SBCLogEvent [2/2]#
Default constructor.
function getDescriptionMessage#
Returns message that describe the event.
function getFileLine#
Returns line number where event is recorded.
function getFilename#
Returns fileName where event is recorded.
function getFunctionName#
Returns function name where event is recorded.
function getLibraryUUID#
Returns uuid of library where event is recorded.
function getTime#
Returns event date.
function getType#
Returns event type.
function hash#
Returns the hash of the event.
function isSerializable#
Returns true
__
function serialize#
Serializes the logEvent.
virtual void SBCLogEvent::serialize (
SBCSerializer * serializer,
const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
) const
function setDescriptionMessage#
Sets a message describing the event.
function setFileLine#
Sets line number where event is recorded.
function setFilename#
Sets fileName where event is recorded.
function setFunctionName#
Sets function name where event is recorded.
function setLibraryUUID#
Sets uuid of library where event is recorded.
function setTime#
Sets event date.
function setType#
Sets event type.
function toString#
Returns event formatted the following way: YYYY-MM-D_HH-MM-SS-mmm depending on the print options given as input.
Parameters:
printTime
set to true (default) if date is printedprintLocation
set to true (default) if File/Line is printed
function unserialize#
Unserializes the logEvent.
virtual void SBCLogEvent::unserialize (
SBCSerializer * serializer,
const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
)
function ~SBCLogEvent#
Destructor.
Public Static Functions Documentation#
function getPublicTypeString#
Returns the public string representation of the given SBCLogEvent::Type .
function getTypeFromString#
Returns the SBCLogEvent::Type from the given string.
function getTypeString#
Returns the string representation of the given SBCLogEvent::Type .
function hideFilePaths#
Hides the file path from the input
for privacy.