[math4] Progress and questions
Ankit Sharma
ankitintokyo at yahoo.com
Tue Jan 11 12:02:17 EST 2011
Hi Meschino-san
Thank you for your mail. I tried this, please let me know your opinion, then I
will continue. As Karlie said it is better to Fail early, fail often.
So here's the plan:
To log messages with levels of DEBUG and higher to file, and those messages at
level INFO and higher to the console. Let’s also assume that the file should
contain timestamps, but the console messages should not.
(Added benefit of this would be that we can do away with the print statements in
the code and whatever we want to print, we make it a INFO or higher level of
logging)
#setting up logging before doing anything else (This is in MafhActivity.py)
# set up logging to file
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(name)-12s %(levelname)-8s
%(message)s',
datefmt='%m-%d %H:%M',
filename=PWD_PATH+LOG_FILE_NAME, <<--- Added by
me in constants.py
filemode='w')
# define a Handler which writes INFO messages or higher to the sys.stderr
console = logging.StreamHandler()
console.setLevel(logging.INFO)
# set a format which is simpler for console use
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') <<---
no timestamp here
# tell the handler to use this format
console.setFormatter(formatter)
# add the handler to the root logger
logging.getLogger('').addHandler(console)
# Now, we can log to the root logger, or any other logger. First the root...
logging.info('Starting Game..')
# Now, define a couple of other loggers which might represent other modules
loggerBattleEngine = logging.getLogger('BattleEngine') <<< -- Logging from
other modules
loggerEnemy = logging.getLogger('Enemy')
The advantage I see for using separate BattleEngine logging is I saw function
def get_enemy(key):
if key in ENEMY:
return Enemy( key )
else:
raise InvalidEnemyException() <<--- Here we just pass, currently. We can
add log here.
Please let me know what you think. I am not well-versed with Python and with
this code. I have not been able to run it well (some problems with screen
resolution, keyboard commands where I cannot see the commands) and this is my
first ever suggestion to an Open source project.
Also, please let me know how can I submit changes efficiently , there has to be
a better way than just mailing things like this.
Regards
-Ankit
________________________________
From: Jonathan Meschino (RIT Student) <jam2707 at rit.edu>
To: Ankit Sharma <ankitintokyo at yahoo.com>
Cc: Justin Lewis <jlew.blackout at gmail.com>; Karlie Robinson
<karlie_robinson at webpath.net>; fourthgrademath at lists.sugarlabs.org
Sent: Mon, January 10, 2011 11:08:32 AM
Subject: Re: [math4] Progress and questions
And I'd say to make it a keyboard button push to display it. Something that
won't accidentally get entered by the user; like CONTROL+SHIFT+0 or something.
On Mon, Jan 10, 2011 at 2:06 PM, Jonathan Meschino (RIT Student)
<jam2707 at rit.edu> wrote:
That is definitely how it is done in the professional world and sounds good to
me : ) As long as Justin is fine by it, then sure.
>
>
>
>On Mon, Jan 10, 2011 at 12:52 PM, Ankit Sharma <ankitintokyo at yahoo.com> wrote:
>
>Hi
>>
>>Thank you for your mail. I was busy here too and expected you to be busy over
>>X-mas and New year.
>>I will try what you suggested.
>>
>>By the way, what do you think about adding logs? The purpose is two-fold.
>>1)We can save logs to some file that would be saved somewhere where the
>>application has permissions and unliked whenever a new game is started, this way
>>if some user has some problem and we are not able to reproduce (for some arcane
>>reason), we can always have a look at logs.
>>2)The other reason being, this will get newbies like me get on track faster, as
>>it will allow taking a look at logs and deducing the code flow.
>>
>>
>>
>>If you worry about logs being added in release version, we can just either do
>>away with them completely and/or just include the critical/fatal errors in
>>release mode.
>>If #1 is not acceptable, and logs will be used only internally, we can have the
>>option of getting logs through command line?
>>
>>
>>Let me know your thoughts. I do not how good is this idea, but just had this
>>thought for a while.
>>
>>Regards
>>-Ankit
>>
>>
________________________________
From: Justin Lewis <jlew.blackout at gmail.com>
>>To: Karlie Robinson <karlie_robinson at webpath.net>
>>Cc: Ankit Sharma <ankitintokyo at yahoo.com>; fourthgrademath at lists.sugarlabs.org
>>Sent: Mon, December 27, 2010 11:08:44 AM
>>Subject: Re: [math4] Progress and questions
>>
>>
>>Sorry for the delay, have been a but busy over here...
>>
>>As for your git problems. If you are running from git, you need to
>>activate the submodule:
>>
>>https://fedorahosted.org/fortune_hunter/
>> Clone the repository git
>> Cd to the directory, if you don't have fortune engine installed you
>>can pull the submodule included in the repository
>> git submodule init
>> git submodule update
>>
>>The game engine is in another repo. You may also download fortune
>>engine as a stand alone and install it.
>>https://fedorahosted.org/fortune_hunter/wiki/FortuneEngine
>>
>>
>>Justin Lewis
>>http://jlewopensource.com
>>
>>
>>
>>On Thu, Dec 16, 2010 at 4:20 PM, Karlie Robinson
>><karlie_robinson at webpath.net> wrote:
>>> On 12/16/2010 10:50 AM, Ankit Sharma wrote:
>>>>
>>>> I am sorry if I make silly mistakes.I am sorry if this comes as whining
>>>> since I have no right to criticize something which I have not
created/helped
>>>> with. That is why I wanted to fix these and then send them for review.
>>>>
>>>> In future, I will post on the mailing list. Sorry for being so difficult
>>>> and clumsy.
>>>
>>> Don't apologies, we're all learning something or another. Right now I'm
>>> trying to write a website for a Buddhist Meditation master. I'm not sure I
>>> understand what I've been told so that I can clearly explain his process to
>>> others.
>>>
>>> Just remember, we all started somewhere and I had people to answer silly
>>> questions for me. You'll find it to be more helpful for everyone, even
>>> those who have the same questions as you, to post to the mailing list so we
>>> can all learn as we go along.
>>>
>>> People can learn about Fortune Hunter, and python, and all the other bits by
>>> following along, so you will be their teacher if we post to the mailing
>>> list.
>>>
>>> * I am replying to the mailing list so we can get this out in the open.
>>> Ankit, please don't worry about being new to FOSS, we'll all help you as we
>>> can.
>>>
>>> ~Karlie
>>> _______________________________________________
>>> FourthGradeMath mailing list
>>> FourthGradeMath at lists.sugarlabs.org
>>> http://lists.sugarlabs.org/listinfo/fourthgrademath
>>>
>>
>>
>>_______________________________________________
>>FourthGradeMath mailing list
>>FourthGradeMath at lists.sugarlabs.org
>>http://lists.sugarlabs.org/listinfo/fourthgrademath
>>
>>
>
>
>
>--
> ~ jON mESCHINO
> bS vIDEO gAME dESIGN & dEVELOPMENT (igm)
> 5TH yR @ RIT
>
--
~ jON mESCHINO
bS vIDEO gAME dESIGN & dEVELOPMENT (igm)
5TH yR @ RIT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/fourthgrademath/attachments/20110111/42268eb2/attachment.html>
More information about the FourthGradeMath
mailing list