Closed Bug 1170093 Opened 9 years ago Closed 9 years ago

[gui] add a log report view

Categories

(Testing :: mozregression, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: parkouss, Assigned: sabergeass, Mentored)

References

Details

Attachments

(1 file)

49 bytes, text/x-github-pull-request
parkouss
: review+
Details | Review
For now the gui is just printing some mozregression logs to stdout. This is a problem because: 1. not all logs are printed (level >= WARNING by default) 2. this is not convenient because we have to run the application through a console to see the logs. We should add a (dockable?) log view that user can show or hide to see what is happening easily at real time. This should also be copy/paste able so this could be used in a bug report. We should probably start by implementing a Log Handler and add it to our StructuredLogger object (http://mozbase.readthedocs.org/en/latest/mozlog_structured.html#mozlog.structured.structuredlog.StructuredLogger.add_handler). This LogHandler could be at the same time a Qt model, able to keep log messages and connected with a log report view that will display this log data.
See Also: → 1169992
(In reply to Julien Pagès from comment #0) Hi Julien, Maybe I could work on this one :)
Hi MikeLing, Sure, if you're interested, please assign yourself to this bug! (I think you now have edit rights on bugzilla, else I can assign this to you)
Assignee: nobody → sabergeass
(In reply to Julien Pagès from comment #2) > Hi MikeLing, > > Sure, if you're interested, please assign yourself to this bug! (I think you > now have edit rights on bugzilla, else I can assign this to you) Thank you for your trust :D Maybe we could talk about it on irc, I'm waiting for you :)
Flags: needinfo?(sabergeass)
(In reply to Carsten Book [:Tomcat] from comment #5) > sorry had to back this out for test failures like > https://treeherder.mozilla.org/logviewer.html#?job_id=2107388&repo=b2g- > inbound ignore that, inital commit that caused that bustage had a wrong bug number in it
Flags: needinfo?(sabergeass)
We talked more about it with MikeLing by mail. Here is the code that add a log handler: > class LogModel(object): > def __init__(self): > self.logs=[] > > def __call__(self, data): > print "I got a log", data > self.logs.append(data) > > def main(): > ..... > log_model = LogModel() > StructuredLogger('mozregression-gui').add_handler(log_model) > > And I got log message like this: > > I got a log {u'thread': 'Dummy-1', u'level': u'DEBUG', u'pid': 3454, > u'component': 'Build Finder', u'source': 'mozregression-gui', u'time': > 1433897548588, u'action': u'log', u'message': u'We got 366 folders, we > need to fetch [0, 183, 365]'} > I got a log {u'thread': 'Dummy-1', u'level': u'DEBUG', u'pid': 3454, > u'component': 'Build Finder', u'source': 'mozregression-gui', u'time': > 1433897605777, u'action': u'log', u'message': u'Now we got 365 folders > - 1 were bad'} > I got a log {u'thread': 'Dummy-1', u'level': u'DEBUG', u'pid': 3454, > u'component': 'Build Finder', u'source': 'mozregression-gui', u'time': > 1433897548588, u'action': u'log', u'message': u'We got 366 folders, we > need to fetch [0, 183, 365]'} > I got a log {u'thread': 'Dummy-1', u'level': u'DEBUG', u'pid': 3454, > u'component': 'Build Finder', u'source': 'mozregression-gui', u'time': > 1433897605777, u'action': u'log', u'message': u'Now we got 365 folders > - 1 were bad'} So now, the main thing to do is to write a custom QPlainTextEdit that will be able to display these log messages. Also, to be updated realtime, we should have a synchronisation mecanism, like Qt signal/slots (http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slots.html). This means that our LogModel should inherit from QObject, and emit a 'log' signal for each log we have. Then our custom QPlainTextEdit should have a slot 'on_log_received' that will display the log information.
(In reply to Julien Pagès from comment #8) I see, thank you for your help:)
(In reply to Julien Pagès from comment #8) Hi julien, I just see the slot in mozregression-gui is: @Slot(), which is Pyside grammar. But I haven't found somewhere Pyside been import.
This is a trick: https://github.com/mozilla/mozregression/blob/master/gui/mozregui/main.py#L8 PyQt4.QtCore.pyqtSlot is pretty much equivalent (if not exactly) to PySide.QsCore.Slot, so I imported that under the same name (in case we want to switch back to PySide).
Attached file first version patch
Hm, I'm still wondering about how to make 'time' readable. But I still would like to make a PR and ask review. If you found any problem of my PR, please let me know and I will fix it with the "readable time" issue at once. Thank you :)
Attachment #8617936 - Flags: review?(j.parkouss)
Attachment #8617936 - Flags: review?(j.parkouss)
Thanks this looks great! I noted some minor things on the PR - the main important thing is that you clear the complete logs if we reach the 1000 log entries - instead, we should just remove the oldest log entry line and add the new one.
(In reply to Julien Pagès from comment #13) > Thanks this looks great! > > I noted some minor things on the PR - the main important thing is that you > clear the complete logs if we reach the 1000 log entries - instead, we > should just remove the oldest log entry line and add the new one. OK, thank you for your help:) Btw, I notice my pr is failed but not because the compile problem. I don't understand reason by the coverage is decrease and failure comes out. Could you give me a hint?
Comment on attachment 8617936 [details] [review] first version patch I hope this patch can work appropriate :) Log message output in Log view are like below: > 2015-06-11T21:26:14: DEBUG : We got 366 folders, we need to fetch [0, 183, 365] > 2015-06-11T21:26:28: DEBUG : Now we got 366 folders - 0 were bad
Attachment #8617936 - Flags: review?(j.parkouss)
Comment on attachment 8617936 [details] [review] first version patch This look great to me, thanks MikeLing! There is some minor things that I would like to be addressed before merging this. I'll note that on the PR right now. Once this is fixed, I have a few ideas to make this look nicer - I will open bugs for that. Nice to see some logs in mozregression-gui :)
Attachment #8617936 - Flags: review?(j.parkouss) → review+
Blocks: 1173981
Blocks: 1173984
Blocks: 1174103
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: