SELKIELogger  1.0.0
SELKIELogger.SLMessages.SLMessageSink Class Reference

Parse incoming messages. More...

Public Member Functions

def __init__ (self, msglogger=None)
 Initialise message sink. More...
 
def SourceMap (self)
 
def FormatMessage (self, msg)
 Pretty print a message. More...
 
def Process (self, message, output="dict", allMessages=False)
 Process an incoming message. More...
 

Private Attributes

 _sm
 Channel Map to be filled from input data.
 
 _log
 General logging object.
 
 _msglog
 Logger for messages extracted from data.
 

Detailed Description

Parse incoming messages.

Maintains an internal mapping of channel and source names to provide prettier output.

Expects data to be provided one message at a time to .Process(), and will return data as a dict, printable string or as an SLMessage().

Definition at line 495 of file SLMessages.py.

Constructor & Destructor Documentation

◆ __init__()

def SELKIELogger.SLMessages.SLMessageSink.__init__ (   self,
  msglogger = None 
)

Initialise message sink.

Optionally accepts a logging object for any error, warning, or information messages encountered in the source data.

Parameters
msgloggerLogger object for messages extracted from data

Definition at line 505 of file SLMessages.py.

Member Function Documentation

◆ FormatMessage()

def SELKIELogger.SLMessages.SLMessageSink.FormatMessage (   self,
  msg 
)

Pretty print a message.

Parameters
msgMessage object
Returns
Formatted Message as string

Definition at line 531 of file SLMessages.py.

◆ Process()

def SELKIELogger.SLMessages.SLMessageSink.Process (   self,
  message,
  output = "dict",
  allMessages = False 
)

Process an incoming message.

Accepts SLMessage object or bytes that can be unpacked into one.

If a valid message is decoded, internal data structures are updated to provide channel and source names for message formatting and tracking of the last timestamp seen from each source. Any data messages are returned as a string or as a dictionary.

Parameters
messageMessage (or bytes) to be decoded
outputOutput format for each message: String, dict, raw (SLMessage)
allMessagesOutput messages normally used internally
Returns
Message in selected format

Definition at line 539 of file SLMessages.py.

◆ SourceMap()

def SELKIELogger.SLMessages.SLMessageSink.SourceMap (   self)
Returns
Source/Channel map

Definition at line 527 of file SLMessages.py.


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