analytics package
Subpackages
Submodules
analytics.eventhandler module
Execute action when event occurs
- class analytics.eventhandler.EventHandler(config_queue, config_file=None, redis_host='localhost', redis_port=6379, redis_stream='detection')
Bases:
object
Event handler class
- get_file_configuration(config_file)
Get Configuration from file
- Returns:
an object with the file configuration
- Return type:
Configuration
- loop_events()
Execute enabled actions when receive a redis message
analytics.logger module
Service Logger
- class analytics.logger.CustomFormatter(format_str)
Bases:
Formatter
Custom formatter for logging
- format(record)
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
- class analytics.logger.Logger
Bases:
object
This class contains the methods used to configure the service logger.
- LOGGER_NAME = 'analytics'
- classmethod get_logger()
Get logger with the given name
- Returns:
A logger object
- Return type:
logging
- classmethod init(log_level=20, log_file: str = None)
initialize the service logger
- Parameters:
log_level (optional) – Logging level as in logging. Defaults to logging.INFO.
log_file (str, optional) – Log file path. Defaults to None.
analytics.main module
Server entry point
- analytics.main.main()
Main application
- analytics.main.parse_args()
Parse arguments
analytics.server module
Base HTTP server using Flask.
analytics.streamrecorder module
Stream recorder