Trying to provide a global logging function
Posted
by Gekitsuu
on Stack Overflow
See other posts from Stack Overflow
or by Gekitsuu
Published on 2010-05-31T03:08:52Z
Indexed on
2010/05/31
3:12 UTC
Read the original article
Hit count: 189
python
I typically write my scripts with a structure like s
#!/usr/bin/python
import stuff
def do_things():
print "FOO"
def main():
do_things()
if __name__ == "__main__":
main()
The problem I have is I'd like to have a logging function that is defined globally and I"m not really sure how to do this. I tried a decorator function but if I define it in main I can't call it from other functions in the script. It seems like something that should be easy to do but not something I have experience with.
© Stack Overflow or respective owner