Advertisement
Guest User

Untitled

a guest
Mar 5th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. import logging
  2. import logging.config
  3. import os
  4.  
  5.  
  6. CACHE_HOST = os.environ["CACHE_HOST"]
  7. CACHE_PORT = int(os.environ["CACHE_PORT"])
  8.  
  9. DATABASE_ENGINE = os.environ["DATABASE_ENGINE"]
  10. DATABASE_HOST = os.environ["DATABASE_HOST"]
  11. DATABASE_PORT = int(os.environ["DATABASE_PORT"])
  12. DATABASE_NAME = os.environ["DATABASE_NAME"]
  13. DATABASE_USER = os.environ["DATABASE_USER"]
  14. DATABASE_PASSWORD = os.environ["DATABASE_PASSWORD"]
  15.  
  16. DEBUG = "INPROMO_DEBUG" in os.environ
  17. LOGGING = {
  18. "version": 1,
  19. "disable_existing_loggers": False,
  20. "formatters": {
  21. "main": {
  22. "format": "%(asctime)-15s %(levelname)-8s\n" + " " * 16 + "%(message)s",
  23. },
  24. "debug": {
  25. "format": "%(asctime)-15s %(levelname)-8s %(lineno)-4s\n" + " " * 16 + "%(message)s",
  26. },
  27. },
  28. "handlers": {
  29. "main": {
  30. "class": "logging.StreamHandler",
  31. "level": "WARNING",
  32. "formatter": "main",
  33. },
  34. "debug": {
  35. "class": "logging.StreamHandler",
  36. "level": "DEBUG",
  37. "formatter": "debug",
  38. },
  39. },
  40. "loggers": {
  41. "": {
  42. "handlers": ["main" if DEBUG else "debug"],
  43. "propagate": True,
  44. },
  45. },
  46. }
  47.  
  48. logging.config.dictConfig(LOGGING)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement