#python #debugging #ic #icecream
https://medium.com/pythoneers/debugging-in-python-replace-print-with-ic-and-do-it-like-a-pro-18f330c863cb
from icecream import ic
# Using ic() to debug
ic(add(10, 20))
ic(add(30, 40))
ic| add(10, 20): 30
ic| add(30, 40): 70
ic.disable() # Disables ic()
ic(multiply(3, 3)) # Prints nothing
ic.enable() # Re-enables ic()
ic(multiply(3, 3)) # Output: ic| multiply(3, 3): 9
def log_to_file(text):
with open("debug.log", "a") as f:
f.write(text + "\n")
ic.configureOutput(prefix="DEBUG| ", outputFunction=log_to_file)
ic(multiply(7, 7))
https://medium.com/pythoneers/debugging-in-python-replace-print-with-ic-and-do-it-like-a-pro-18f330c863cb
Medium
Debugging in Python: Replace print() with ic() and Do It Like a Pro
Introduction:
✍1