Closed
Bug 1072747
Opened 12 years ago
Closed 12 years ago
[titanic] titanic should use logging module instead of using print statements
Categories
(Testing :: General, defect)
Testing
General
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: devty1023, Unassigned, Mentored)
Details
(Whiteboard: [lang=py][good first bug])
Attachments
(1 file)
|
6.53 KB,
patch
|
gakiwate
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0
Build ID: 20140830210550
Steps to reproduce:
titanic.py and backfill,py currently uses 'print' statements to display various messages. Python provides a modern and an elegant solution to logging information/warning/errors via its logging module (https://docs.python.org/2/howto/logging.html)
Expected results:
Titanic should try to remove any and all print statement and replace them with proper level of logging messages.
| Reporter | ||
Updated•12 years ago
|
Mentor: devty1023, gautam.akiwate
Flags: needinfo?(gautam.akiwate)
Whiteboard: [lang=py][good first bug]
Updated•12 years ago
|
Flags: needinfo?(gautam.akiwate)
Just wondering if there is a way to mark a bug as enhancement. Like in this case, it is not exactly a bug but more of a inclusion of a better practice.
Updated•12 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•12 years ago
|
||
Let's ask the Bugzilla expert.
Joel, any thoughts on how the team usually handles "enhancements" in Bugzilla?
Flags: needinfo?(jmaher)
Comment 4•12 years ago
|
||
no need to. Bugzilla can be used for any "work item"
Flags: needinfo?(jmaher)
| Reporter | ||
Comment 5•12 years ago
|
||
Good to know! Thanks Joel.
| Reporter | ||
Comment 6•12 years ago
|
||
Since I cannot make assignment of bugs (access level problem?) I would appreciate if someone could assign this to Harsh.
Flags: needinfo?(gautam.akiwate)
| Reporter | ||
Comment 8•12 years ago
|
||
Thank you :)
| Reporter | ||
Comment 9•12 years ago
|
||
bump! How is the ticket going?
| Reporter | ||
Updated•12 years ago
|
Flags: needinfo?(harshjha2006)
Comment 10•12 years ago
|
||
Hi Daniel,
I'm sorry, I'm not getting time to look into this at all.
Assignee: harshjha2006 → nobody
Flags: needinfo?(harshjha2006)
| Reporter | ||
Comment 11•12 years ago
|
||
Thanks for letting me know! I will pick up where you left off!
| Reporter | ||
Comment 12•12 years ago
|
||
Starting to look at this, faced with a issue:
When functions such as "printCommand" is called, it appears that it is directly printing to the console (stdout). What is the use case for these - are some scripts written to redirect the output of titanic.py?
e.g.
python titanic.py [options] > output.txt
Is this something that I should be considering?
In fact, what is the use case for titanic? How is it used? :) we can probably talk about this tomorrow as well.
Flags: needinfo?(gautam.akiwate)
Comment 13•12 years ago
|
||
(In reply to Daniel Y Lee from comment #12)
> Starting to look at this, faced with a issue:
>
> When functions such as "printCommand" is called, it appears that it is
> directly printing to the console (stdout). What is the use case for these -
> are some scripts written to redirect the output of titanic.py?
>
> e.g.
>
> python titanic.py [options] > output.txt
>
> Is this something that I should be considering?
This will likely never happen. However, we would like to still print to stdout if we call printCommands. Basically, that is a way of using Titanic if a person does not want to use it as a library but as a standalone tool.
>
> In fact, what is the use case for titanic? How is it used? :) we can
> probably talk about this tomorrow as well.
There are two ways Titanic can be used. One as a standalone program and the second as a library. If you remember, we discussed about how Titanic was initially designed as a standalone program which is why it is littered with sys.exit(). However, we realized that we could make it more generic and put it to better use if we used it as a library. This is where the APIs come in handy.
Infact, backfill.py is a usecase of Titanic being used as a library.
Let me know if you have any more questions? :)
Flags: needinfo?(gautam.akiwate)
| Reporter | ||
Comment 14•12 years ago
|
||
Very straightforward patch, with one important impact.
The output of logger looks as follows
<LEVEL>:<NAME>:<MESSAGE>
for instance
INFO:__main__:[u'success', 'Ubuntu ASAN VM 12.04 x64',...]
if there are any dependencies in applications using titanic.py who expects the output to be
[u'success', 'Ubuntu ASAN VM 12.04 x64',...]
I would need to know and make appropriate changes..
Daniel
Attachment #8504456 -
Flags: review?(gautam.akiwate)
Comment 15•12 years ago
|
||
Comment on attachment 8504456 [details] [diff] [review]
0001-Bug-1072747-titanic-titanic-should-use-logging-modul.patch
Review of attachment 8504456 [details] [diff] [review]:
-----------------------------------------------------------------
The patch looks good to me. We have nothing as of now that depends on the output of Titanic.
Attachment #8504456 -
Flags: review?(gautam.akiwate) → review+
| Reporter | ||
Comment 16•12 years ago
|
||
Thanks for taking a look at it Gautam. Will push to github!
| Reporter | ||
Comment 17•12 years ago
|
||
I would like to close this ticket :)
https://github.com/gakiwate/titanic/commit/8071c1ff9a9a0dc2b220edc929aaabc5ffadb96a
| Reporter | ||
Comment 18•12 years ago
|
||
i.e. I can't close the ticket and would like someone to
You need to log in
before you can comment on or make changes to this bug.
Description
•