how to make my log more flexible?

Discussion in 'Python' started by Frank Zheng, Oct 20, 2003.

  1. Frank Zheng

    Frank Zheng Guest

    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
     
    Frank Zheng, Oct 20, 2003
    #1
    1. Advertising


  2. >>> "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 <>
    It's never too late to have a happy childhood.
     
    Anthony Baxter, Oct 20, 2003
    #2
    1. Advertising

  3. Frank Zheng

    nobody Guest

    Exercise it!

    "Frank Zheng" <> wrote in message
    news:bmvk2k$1too$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
    >
    >
    >
    >
    >
    >
    >
    >
    >
     
    nobody, Oct 20, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGV2aW4=?=

    More flexible programs for the design of a page

    =?Utf-8?B?RGV2aW4=?=, Jun 1, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    321
    John Oakes
    Jun 1, 2004
  2. Collin VanDyck

    More flexible DTD solution needed

    Collin VanDyck, Jan 28, 2005, in forum: XML
    Replies:
    4
    Views:
    469
    Richard Tobin
    Jan 31, 2005
  3. Antoon Pardon

    A more flexible formatting proposal

    Antoon Pardon, May 6, 2004, in forum: Python
    Replies:
    0
    Views:
    299
    Antoon Pardon
    May 6, 2004
  4. Jonathan Fine
    Replies:
    0
    Views:
    311
    Jonathan Fine
    Mar 7, 2007
  5. JJA
    Replies:
    0
    Views:
    131
Loading...

Share This Page