Andre Engels wrote: > 2006/4/18, Kent Johnson <[EMAIL PROTECTED]>: >> János Juhász wrote: >>> Hi All, >>> >>> Is it possible to replace the print statement with one of mine function ? >>> >>> In reality, I would like to replace the print in my PyCrust app with the >>> log.write() function. >> Best: Use a good editor to change your print statements to log.write() > > Even better: Use a good editor to change your print statements to > myprint() and then def myprint() to be log.write(). This has the > advantage that if (for example) you want prints later to be "usually > log.write() but if redFlagHighestWarning is True, then both > log.write() and print()", you don't need to go through all this again, > but just have to change myprint().
Or use the logging module, which lets you make changes like this by editing a config file. I usually set it up so that INFO level and higher messages go to a console or GUI panel, and all messages go to a rollover file. Very handy. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor