pycti.utils.opencti_logger ========================== .. py:module:: pycti.utils.opencti_logger Classes ------- .. autoapisummary:: pycti.utils.opencti_logger.CustomJsonFormatter Functions --------- .. autoapisummary:: pycti.utils.opencti_logger.logger Module Contents --------------- .. py:class:: CustomJsonFormatter(*args, json_default: Optional[Callable] = None, json_encoder: Optional[Callable] = None, json_serializer: Callable = json.dumps, json_indent: Optional[Union[int, str]] = None, json_ensure_ascii: bool = True, **kwargs) Bases: :py:obj:`pythonjsonlogger.json.JsonFormatter` Custom JSON formatter for structured logging. :param args: see [BaseJsonFormatter][pythonjsonlogger.core.BaseJsonFormatter] :param json_default: a function for encoding non-standard objects :param json_encoder: custom JSON encoder :param json_serializer: a [`json.dumps`](https://docs.python.org/3/library/json.html#json.dumps)-compatible callable that will be used to serialize the log record. :param json_indent: indent parameter for the `json_serializer` :param json_ensure_ascii: `ensure_ascii` parameter for the `json_serializer` :param kwargs: see [BaseJsonFormatter][pythonjsonlogger.core.BaseJsonFormatter] .. py:method:: add_fields(log_record, record, message_dict) Add custom fields to the log record. :param log_record: The log record dictionary :param record: The LogRecord instance :param message_dict: The message dictionary .. py:function:: logger(level, json_logging=True) Create a logger with JSON or standard formatting. :param level: Logging level (e.g., logging.INFO, logging.DEBUG) :type level: int :param json_logging: Whether to use JSON formatting for logs :type json_logging: bool :return: AppLogger class :rtype: class