how to make my log more flexible?

F

Frank Zheng

Hi, all:
I have a GUI program , And i add log in my program to know what happened
at run time.

for example:
def fun(log):
....#do some sth
log.write('do some sth')

at run time:
fun(open('mylogfile.log','w'))

Now, I want do some unit test first, my question is what param to be passed
to 'fun' can make 'log.write(...)' work as 'print'?

Thanks in advance!


Frank
 
A

Anthony Baxter

for example:
def fun(log):
...#do some sth
log.write('do some sth')

at run time:
fun(open('mylogfile.log','w'))

Now, I want do some unit test first, my question is what param to be passed
to 'fun' can make 'log.write(...)' work as 'print'?


sys.stdout or sys.stderr.

Anthony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,433
Messages
2,571,683
Members
48,796
Latest member
Greg L.

Latest Threads

Top