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

Can we get line number details in the logging output? #211

Closed
jarvisteach opened this Issue Aug 16, 2017 · 4 comments

Comments

Projects
None yet
1 participant
@jarvisteach
Owner

jarvisteach commented Aug 16, 2017

There is an inspect module:

That allows us to look back through the stack, each entry induces a line number and function name.

We can add this to the logging function (logMessage) - but need to go back a couple of function calls in order to find the line that called us.

@jarvisteach jarvisteach added this to the 0.08 milestone Aug 16, 2017

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Aug 16, 2017

Owner

NB. this won't take effect if called from static classes or subclasses - should we make the logging functions static also??

Owner

jarvisteach commented Aug 16, 2017

NB. this won't take effect if called from static classes or subclasses - should we make the logging functions static also??

jarvisteach added a commit that referenced this issue Aug 16, 2017

Fixes to deleteTickBox & changes to Logging
Updates to fix issues with deleting tickBoxes from OptionLists (#132)

Introduced inspect to logging - logged messages now print the line
number and function that generated them. (#211)

Also, made logging functions static, so that static functions and
subClasses that logged messages could use same features. (#211)

Added a PauseLogger to ToolTips - not sure why it wasn’t already there,
must have missed it. (#212)
@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Aug 16, 2017

Owner

Now logs:

  • [line number/function name] for appJar messages
  • [line number] for external logs

Can now go through code and tidy up log messages - don't need to say function name in the message!

Owner

jarvisteach commented Aug 16, 2017

Now logs:

  • [line number/function name] for appJar messages
  • [line number] for external logs

Can now go through code and tidy up log messages - don't need to say function name in the message!

jarvisteach added a commit that referenced this issue Aug 16, 2017

Updates to logging & tooltips
Empty tooltips now disable them (#212)

Logging gives better details about main calling line. [#211]
@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Aug 16, 2017

Owner

Uses a loop to find first stack entry with the main program's filename.

Convinced this will break in interactive mode or something similar - need to consolidate best way for finding calling program's name, make it global & static and use everywhere...

Owner

jarvisteach commented Aug 16, 2017

Uses a loop to find first stack entry with the main program's filename.

Convinced this will break in interactive mode or something similar - need to consolidate best way for finding calling program's name, make it global & static and use everywhere...

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Aug 16, 2017

Owner

Indeed it does:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "appJar/appjar.py", line 432, in __init__
    self.__checkMode()
  File "appJar/appjar.py", line 629, in __checkMode
    self.warn("Interactive mode is not fully tested, some features might not work.")
  File "appJar/appjar.py", line 1499, in warn
    def warn(message): gui.logMessage(message, "WARNING")
  File "appJar/appjar.py", line 1513, in logMessage
    if str(os.path.basename(theMain.__file__)) in s[1]:
Owner

jarvisteach commented Aug 16, 2017

Indeed it does:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "appJar/appjar.py", line 432, in __init__
    self.__checkMode()
  File "appJar/appjar.py", line 629, in __checkMode
    self.warn("Interactive mode is not fully tested, some features might not work.")
  File "appJar/appjar.py", line 1499, in warn
    def warn(message): gui.logMessage(message, "WARNING")
  File "appJar/appjar.py", line 1513, in logMessage
    if str(os.path.basename(theMain.__file__)) in s[1]:

jarvisteach added a commit that referenced this issue Aug 16, 2017

Tidied up file name detection #211
All parts now sharing same static variables (except —help option)

jarvisteach added a commit that referenced this issue Aug 16, 2017

Updated docs
Whats new for #211, #212, #213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment