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)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: devty1023, Unassigned, Mentored)

Details

(Whiteboard: [lang=py][good first bug])

Attachments

(1 file)

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.
Mentor: devty1023, gautam.akiwate
Flags: needinfo?(gautam.akiwate)
Whiteboard: [lang=py][good first bug]
Flags: needinfo?(gautam.akiwate)
Working on it!
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.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Let's ask the Bugzilla expert. Joel, any thoughts on how the team usually handles "enhancements" in Bugzilla?
Flags: needinfo?(jmaher)
no need to. Bugzilla can be used for any "work item"
Flags: needinfo?(jmaher)
Good to know! Thanks Joel.
Since I cannot make assignment of bugs (access level problem?) I would appreciate if someone could assign this to Harsh.
Flags: needinfo?(gautam.akiwate)
all done!
Assignee: nobody → harshjha2006
Flags: needinfo?(gautam.akiwate)
Thank you :)
bump! How is the ticket going?
Flags: needinfo?(harshjha2006)
Hi Daniel, I'm sorry, I'm not getting time to look into this at all.
Assignee: harshjha2006 → nobody
Flags: needinfo?(harshjha2006)
Thanks for letting me know! I will pick up where you left off!
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)
(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)
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 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+
Thanks for taking a look at it Gautam. Will push to github!
i.e. I can't close the ticket and would like someone to
Done! :)
Status: NEW → RESOLVED
Closed: 12 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: