|
From: Kevin A. <al...@se...> - 2001-12-14 02:21:54
|
Until we decide on something else, I went ahead and added a 'logToStdout' config option. If logToStdout is 1 (true), then log messages (if enabled) will go to stdout instead of a file. The default is 0 in pythoncard_config.py, but you can update your pythoncard_user_config.py file. I didn't add any methods to change the state once the app is started, but if it is true and you use another debug window such as the shell, then you can use the 'Redirect stdout to Shell' so that all log messages go to the Shell window instead of the console. One of the reasons you might want to do this is when testing a script with the .pyw extension where there is no console window. For example textEditor.pyw -s -l I'll start using log now instead of print statements and see what issues I run into. My "hasty" solutions today are not how we have to do this stuff, so any and all feedback or alternative solutions are welcome. I didn't actually change the singleton implementation for Configuration or Log today since the module references made the actual implementation irrelevant. ka > -----Original Message----- > From: pyt...@li... > [mailto:pyt...@li...]On Behalf Of Kevin > Altis > Sent: Thursday, December 13, 2001 4:34 PM > To: pythoncard-Users > Subject: [Pythoncard-users] logging to the console > > > Most of the time, I want to be able to have the log output just go to the > console (sys.stdout). This should also take care of having > logging output go > to the shell if the "Redirect stdout to Shell" option is enabled. > Yes I know > Unix folks would probably just to a tail on the log file, but that isn't > available for most Windows users. > > We could have "stdout" or "stderr" treated as a special filename > for the log > in which case output is sent to sys.stdout instead of some other > file. Seems > a bit unclean. > > Another possibility is to add an explicit flag to route log messages to > stdout or stderr... This option would need to be added to the config > options. > > Other suggestions? > > Remember that one of the goals is that I want to avoid peppering > the source > (especially samples) with print statements, but just use log instead and > then the log statements can be left in the code without causing much > overhead or outputting unwanted messages to a file or console if logging > isn't enabled. |