Advertisement
Guest User

Untitled

a guest
Jan 28th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. SOLUTION A
  2. ========================
  3. create a function that check the status of the debug flag...
  4.  
  5. #create a global var like this:
  6. DEBUG = True
  7.  
  8.  
  9. def debug_logger(s)
  10. if DEBUG: write_to_log(s)
  11.  
  12. def functionA()
  13. debug_logger("write this message to the log file")
  14.  
  15. SOLUTION B
  16. ========================
  17. have each function that needs to log something check the status of the flag directly
  18.  
  19. #create a global var like this:
  20. DEBUG = True
  21.  
  22. def functionA()
  23. if DEBUG: write_to_log("write this message to the log file")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement