The PEAK Developers' Center   Diff for "HelloWorld" UserPreferences
 
HelpContents Search Diffs Info Edit Subscribe XML Print View
Ignore changes in the amount of whitespace

Differences between version dated 2003-12-09 20:29:28 and 2003-12-09 22:22:19 (spanning 3 versions)

Deletions are marked like this.
Additions are marked like this.

#DEPRECATED
 
Please use IntroToPeak instead.
 
By R. David Murray (rdmurray at bitdance.com) (w/edits by PJE)
 
'''Preface'''

write up your question on the PEAK mailing list, and we'll try to
get these examples updated with more Windows-specific command lines.)
 
(Note to all readers: the examples in this document have been
tested against PEAK CVS. Most examples should work with
0.5 alpha 2, but not all will. There could also be synchronization
errors between the examples and the test code, so if you find
something that doesn't work as advertised when run against current
CVS, please let me know.)
(Note to all readers: the examples in this document have been tested
against PEAK CVS. The examples will not work with 0.5 alpha 2.
There could also be synchronization errors between the examples and
the test code, so if you find something that doesn't work as
advertised when run against current CVS, please let me know.)
 
'''Table of Contents'''
 

}}} Hmm. There's a lot of information and capabilities there. We're
interested in the general format of a logging call, and which logging
calls are provided. Looking through the list of methods, things
like `critical`, '`debug`, `warning`, `error`, and `info` all look
like `critical`, 'debug`, `warning`, `error`, and `info` all look
handy. The other methods we can ignore for now.
 
So let's modify our `to` command to log who is greating whom (I'm
So let's modify our `to` command to log who is greeting whom (I'm
going to omit the `usage` text when I show modified versions
of our commands from now on; you've seen that text often
enough already!): {{{

logger = logs.LogStream(stream=importString('sys.stderr'), level=logs.DEBUG)
}}}
 
Here we are using PEAK's `LogStreamer` logger. To work, it needs
Here we are using PEAK's `LogStream` logger. To work, it needs
to know which stream to write to, so we tell it using
`stream=importString('sys.stderr')`. We need to use importString
`stream=importString('sys.stderr')`. We need to use `importString`
because `sys.stderr` is an import path. We also tell the logger
the minimum level of message to log. (Message levels are named the
same as the corresponding method names, but using all caps).

PythonPowered
ShowText of this page
EditText of this page
FindPage by browsing, title search , text search or an index
Or try one of these actions: AttachFile, DeletePage, LikePages, LocalSiteMap, SpellCheck