thanks so much , I ganna check the formatter str for more info:)

On Wed, Oct 29, 2008 at 5:10 PM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> davy zhang schrieb:
>>
>> mport logging
>> import pickle
>>
>>
>> # create logger
>> logger = logging.getLogger("simple_example")
>> logger.setLevel(logging.DEBUG)
>> # create console handler and set level to debug
>> ch = logging.StreamHandler()
>> ch.setLevel(logging.DEBUG)
>> # create formatter
>> formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s
>> - %(message)s ")
>> # add formatter to ch
>> ch.setFormatter(formatter)
>> # add ch to logger
>> logger.addHandler(ch)
>>
>> d = {'key':'msg','key2':'msg2'}
>>
>> # "application" code
>> logger.debug("debug message",d)#can not do this
>
> logger.debug("yes you can: %r", d)
>
>
> Diez
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to