Leo Breebaart enlightened us with: > Okay, you say, that's still easy. It's just: > > logging.basicConfig(level=logging.DEBUG, > format='%(message)s')
I always use a separate logger, as per my example. That would then just require an additional line: log.setLeveL(logging.DEBUG) > And that's true, but I did have to go and look this up, and I made a > couple of false starts first. I can only repeat that the workings of > the logging framework are rarely intuitive to me. If you're just writing software for yourself, that's fine. If you want to share your software, things that are intuitive to you might not be to others. In such a case (and usually software is going to be shared at some point or another) it's generally a good idea to spend a few minutes learning how to use such a system, because then other people will see your code using things they are already familiar with. Reusing other people's code instead of writing your own logging, also means that other people will fix bugs for you. > I know that it won't take much for a script to become so complex > that the extra stuff logging buys you vastly overpowers the > convenience of the print statements. I have just not needed that > often enough for it to become second nature to use in smaller > scripts as well. I don't use the logging module in small scripts either, but as soon as it gets over 100 lines, I do. It's quite easy to get it going, once you get the hang of it. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? Frank Zappa -- http://mail.python.org/mailman/listinfo/python-list