Skip to main content

Do not use print for debugging and delete print for release

Example Usage

from printDebugging import *
setLevel(DEBUG) # or setLevel("DEBUG")
debug("hi")     # printed out
setLevel(QUIET) # set debug level into QUIET
debug("hi")     # not printed out

# Configure Color
set_color("purple", INFO)         # set foreground color as purple  for info
set_color("WHITE", WARN, "bg")    # set backgournd color as white for warn
add_style("underline", DEBUG)
reset_style(WARN)
reset_style()

# Configure Prefix
setLevel(INFO)
set_prefixes("{trace}", INFO)   # Add string as prefix for INFO
info("HI")                      # FileName with Line number is printed out as prefix
import datetime
set_prefixes(datetime.datetime.now) # Add function with no parameter as prefix
info("hello")                   # Result of `datetime.datetime.now()` is printed out as prefix

# Configure postfix
import traceback
set_postfixes(traceback.format_exc, ERROR)
try:
  0 / 0
except:
  error("Expected Error")             # traceback is printed out

Debug Level

  • QUIET : DO NOT PRINT EXCEPT “error”

  • INFO : Print info and error

  • VERBOSE : Print info, warn and error

  • DEBUG : print info, warn, error and debug

TO DO

Add function with arugment as prefix or postfix

Metadata

Release files for print-debugging 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for print-debugging 0.0.2
File Size Uploaded
print_debugging-0.0.2.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for print-debugging 0.0.2
File Interpreter ABI Platform
print_debugging-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page