Logging handler to send logs to your OpenSearch cluster with bulk SSL. Forked from https://github.com/logzio/logzio-python-handler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
497 B

3 years ago
3 years ago
3 years ago
  1. import sys
  2. import logging
  3. def get_logger(debug):
  4. return __get_logger(debug, __name__)
  5. def get_stdout_logger(debug):
  6. stdout_logger = __get_logger(debug, __name__ + '_stdout', logging.StreamHandler(sys.stdout))
  7. stdout_logger.propagate = False
  8. return stdout_logger
  9. def __get_logger(debug, name, handler=None):
  10. logger = logging.getLogger(name)
  11. logger.setLevel(logging.DEBUG if debug else logging.INFO)
  12. if handler:
  13. logger.addHandler(handler)
  14. return logger