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

Improve logging code and display #143

Merged
merged 10 commits into from Jul 4, 2013
Merged

Improve logging code and display #143

merged 10 commits into from Jul 4, 2013

Conversation

zas
Copy link
Collaborator

@zas zas commented Jul 3, 2013

  • Limit size of stored lines in memory (log.entries became a collections.deque with maxlen = 50000)
  • Ensure log view dialog receiver is removed on dialog close
  • Use numeric log levels instead of string prefix, easier to work with

capture du 2013-07-03 14 56 06
capture du 2013-07-03 14 56 12

self.textCursor.movePosition(QtGui.QTextCursor.End)
self.textCursor.insertText(prefix + ' ' + str(QtCore.QThread.currentThreadId()) + ' ' + time + ' ' + msg, self.textFormat)
formats = {
Copy link
Member

@mineo mineo Jul 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dict never changes but is recreated every time this function is called, it should be a module-/class-level constant instead.

@zas
Copy link
Collaborator Author

zas commented Jul 3, 2013

capture du 2013-07-03 18 45 29


def _stderr_receiver(level, time, msg):
sys.stderr.write("%s: %s %s %s%s" % (_log_prefixes[level],
str(QtCore.QThread.currentThreadId()),
Copy link
Member

@mwiencek mwiencek Jul 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed you removed the currentThreadId from the log window receiver, but not from this one. We should be consistent in how things are displayed. (There's the question of how useful this is since it's apparently the thread the receiver is executing in, not where log.whatever() was called from, but might be safer to just keep it.)

Copy link
Collaborator Author

@zas zas Jul 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if currentThreadId is useful or not (as is), but if it is i don't think Picard users need it (devs may though). This is why i removed it from log view.
About consistency, i generally agree but here it was intentional:

  • GUI log window for everyday's user (no search)
  • console for experienced user and dev (search/grep etc).

I have in the idea to display history of status bar messages in similar fashion (because those are useful but sometimes just disappear too fast, or are too many).

Copy link
Member

@mwiencek mwiencek Jul 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I've ever used the log window for is obtaining tracebacks from users without them having to run Picard from a terminal. In general, non-developers aren't using these messages for anything except reporting bugs. So the messages still have to be useful for developers, because they're the ones fixing the bugs. I don't think we should appropriate this dialog for everyday users.

The status bar idea sounds interesting, but it should be something entirely separate from the log window (and more visible - in my experience, most users on the forum don't know that the log window exists, let alone what it's for).

Anyway, what I wrote above is moot here. Since currentThreadId doesn't appear to be useful, I would just remove it from the stderr receiver as well.

Copy link
Collaborator Author

@zas zas Jul 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in zas@bb8176b

@zas
Copy link
Collaborator Author

zas commented Jul 4, 2013

Squashed few commits and rebased on current master.

mwiencek added a commit that referenced this pull request Jul 4, 2013
Improve logging code and display
@mwiencek mwiencek merged commit 72dce65 into metabrainz:master Jul 4, 2013
@zas zas deleted the logview branch Jul 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants