Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > how to make my log more flexible?

Reply
Thread Tools

how to make my log more flexible?

 
 
Frank Zheng
Guest
Posts: n/a
 
      10-20-2003
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









 
Reply With Quote
 
 
 
 
Anthony Baxter
Guest
Posts: n/a
 
      10-20-2003

>>> "Frank Zheng" wrote

> 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
--
Anthony Baxter <(E-Mail Removed)>
It's never too late to have a happy childhood.


 
Reply With Quote
 
 
 
 
nobody
Guest
Posts: n/a
 
      10-20-2003
Exercise it!

"Frank Zheng" <(E-Mail Removed)> wrote in message
news:bmvk2k$1too$(E-Mail Removed)99.com...
> 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
>
>
>
>
>
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
My.Log.Writeexception not writing to Application Event Log. =?Utf-8?B?VG9tIFdpbmdlcnQ=?= ASP .Net 0 01-20-2006 06:41 PM
Log On Screen Changed. No More Auto-Log On. Jerry G. Computer Support 2 10-22-2004 09:58 AM
Urgent Pls: Facing problem in reading Log information from Log file, created by IIS Amratash ASP .Net 0 04-13-2004 09:08 AM
Need help on the Permissions needed to log to Event Log from ASP.NET? Henrik_the_boss ASP .Net 0 11-05-2003 10:14 AM



Advertisments