tcex.tcex_logger module

ThreatConnect API Logger

class tcex.tcex_logger.TcExLogFormatter(task_name=None)[source]

Bases: logging.Formatter

Logger formatter for ThreatConnect Exchange API logging.

format(record)[source]

Format log record for ThreatConnect API.

Example log event:

[{
    "timestamp": 1478907537000,
    "message": "Test Message",
    "level": "DEBUG"
}]
class tcex.tcex_logger.TcExLogHandler(session, flush_limit=100)[source]

Bases: logging.Handler

Logger handler for ThreatConnect Exchange API logging.

close()[source]

Close the logger and flush entries.

emit(record)[source]

Emit the log record.

log_to_api()[source]

Best effort API logger.

Send logs to the ThreatConnect API and do nothing if the attempt fails.