Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds file and line number info to debug statements #233

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions bin/benchpark
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,29 @@ import shutil
import subprocess
import sys
import yaml
from inspect import currentframe, getframeinfo

DEBUG = False
DEBUG = True

__version__ = "0.1.0"


def get_linenumber():
cf = currentframe()
return cf.f_back.f_back.f_lineno


def get_filename():
cf = currentframe()
return os.path.basename(getframeinfo(cf.f_back).filename)


def debug_print(message):
if DEBUG:
print("(debug) " + str(message))
print(
"(debug) " + get_filename() + "::" + str(get_linenumber()) + " " + message,
file=sys.stderr,
)


def main():
Expand Down Expand Up @@ -62,6 +76,7 @@ def main():


def get_version():
debug_print("Hello, world!")
benchpark_version = __version__
return benchpark_version

Expand Down