Hi Folks,
OK I love the logging module. I use it everywhere. I was happily
putting at the top of each of my scripts
------<snip>------
#!/usr/bin/env python2.4
import logging
LOGLEVEL=loggin g.INFO
# Set's up a basic logger
logging.basicCo nfig(level=LOGL EVEL, format="%(ascti me)s %(name)s %
(levelname)-8s %(message)s",
datefmt='%d %b %Y %H:%M:%S', stream=sys.stde rr)
try:
module= os.path.basenam e(traceback.ext ract_stack(limi t=2)[1]
[0]).split(".py")[0]+"."
except:
module = os.path.basenam e(traceback.ext ract_stack(limi t=2)[0]
[0]).split(".py")[0]+"."
def main(loglevel=F alse):
""" """
# Setup Logging
log = logging.getLogg er(module+sys._ getframe().f_co de.co_name )
if loglevel is not False: log.setLevel(lo glevel)
else:log.setLev el(logging.WARN )
log.debug("I LOVE LOGGING")
if __name__ == '__main__':
sys.exit(main(l oglevel=LOGLEVE L))
------<snip>------
But now you guys continued to make this cool language and 2.5 came
out. Great now how do I put /usr/bin/env python>2.4?
Or can you suggest a better way to skin this cat?
Thanks again!!
OK I love the logging module. I use it everywhere. I was happily
putting at the top of each of my scripts
------<snip>------
#!/usr/bin/env python2.4
import logging
LOGLEVEL=loggin g.INFO
# Set's up a basic logger
logging.basicCo nfig(level=LOGL EVEL, format="%(ascti me)s %(name)s %
(levelname)-8s %(message)s",
datefmt='%d %b %Y %H:%M:%S', stream=sys.stde rr)
try:
module= os.path.basenam e(traceback.ext ract_stack(limi t=2)[1]
[0]).split(".py")[0]+"."
except:
module = os.path.basenam e(traceback.ext ract_stack(limi t=2)[0]
[0]).split(".py")[0]+"."
def main(loglevel=F alse):
""" """
# Setup Logging
log = logging.getLogg er(module+sys._ getframe().f_co de.co_name )
if loglevel is not False: log.setLevel(lo glevel)
else:log.setLev el(logging.WARN )
log.debug("I LOVE LOGGING")
if __name__ == '__main__':
sys.exit(main(l oglevel=LOGLEVE L))
------<snip>------
But now you guys continued to make this cool language and 2.5 came
out. Great now how do I put /usr/bin/env python>2.4?
Or can you suggest a better way to skin this cat?
Thanks again!!
Comment