Web Analytics Made Easy - Statcounter
Skip to content

Class SBCLogEvent#

ClassList > 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.

SBCLogEvent::SBCLogEvent () 


function getDescriptionMessage#

Returns message that describe the event.

const std::string & SBCLogEvent::getDescriptionMessage () 


function getFileLine#

Returns line number where event is recorded.

const std::string & SBCLogEvent::getFileLine () 


function getFilename#

Returns fileName where event is recorded.

const std::string & SBCLogEvent::getFilename () 


function getFunctionName#

Returns function name where event is recorded.

const std::string & SBCLogEvent::getFunctionName () 


function getLibraryUUID#

Returns uuid of library where event is recorded.

const std::string & SBCLogEvent::getLibraryUUID () 


function getTime#

Returns event date.

const std::string & SBCLogEvent::getTime () 


function getType#

Returns event type.

Type SBCLogEvent::getType () 


function hash#

Returns the hash of the event.

size_t SBCLogEvent::hash () const


function isSerializable#

Returns true __

virtual bool SBCLogEvent::isSerializable () const


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.

void SBCLogEvent::setDescriptionMessage (
    const std::string & message
) 


function setFileLine#

Sets line number where event is recorded.

void SBCLogEvent::setFileLine (
    const std::string & line
) 


function setFilename#

Sets fileName where event is recorded.

void SBCLogEvent::setFilename (
    const std::string & name
) 


function setFunctionName#

Sets function name where event is recorded.

void SBCLogEvent::setFunctionName (
    const std::string & name
) 


function setLibraryUUID#

Sets uuid of library where event is recorded.

void SBCLogEvent::setLibraryUUID (
    const std::string & name
) 


function setTime#

Sets event date.

void SBCLogEvent::setTime (
    const std::string & date
) 


function setType#

Sets event type.

void SBCLogEvent::setType (
    Type level
) 


function toString#

Returns event formatted the following way: YYYY-MM-D_HH-MM-SS-mmm depending on the print options given as input.

std::string SBCLogEvent::toString (
    bool printTime=true,
    bool printLocation=true
) const

Parameters:

  • printTime set to true (default) if date is printed
  • printLocation 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.

virtual SBCLogEvent::~SBCLogEvent () 


Public Static Functions Documentation#

function getPublicTypeString#

Returns the public string representation of the given SBCLogEvent::Type .

static std::string SBCLogEvent::getPublicTypeString (
    SBCLogEvent::Type e
) 


function getTypeFromString#

Returns the SBCLogEvent::Type from the given string.

static SBCLogEvent::Type SBCLogEvent::getTypeFromString (
    const std::string & typeString
) 


function getTypeString#

Returns the string representation of the given SBCLogEvent::Type .

static std::string SBCLogEvent::getTypeString (
    SBCLogEvent::Type e
) 


function hideFilePaths#

Hides the file path from the input for privacy.

static std::string SBCLogEvent::hideFilePaths (
    const std::string & input
)