Roman Yakovenko wrote:
>> > One more thing, I write documentation for "readme" feature. Can you
>> post
>> > a code, that change multi_line_formatter_t to default one?
>>
>> Erm, what do you mean? The multi_line_formatter_t class already is the
>> default one...?
>
> I mean I'd like to see the code you replace multi_line_formatter_t with
> formatter from logging package. Or you just replace the whole logger?
I don't know how to obtain a list of handlers from a logger, so I also
don't know how to *replace* the default formatter.
For my Maya bindings I don't replace anything at all, I just add a new
handler to the 'pyplusplus' logger and this handler uses the formatter
from the logging package:
logger = logging.getLogger('pyplusplus')
logger.setLevel(logging.INFO)
filehandler = logging.FileHandler("pyplusplus.log", "wt")
filehandler.setLevel(logging.WARNING)
fmt = logging.Formatter("%(levelname)s: %(message)s")
filehandler.setFormatter(fmt)
logger.addHandler(filehandler)
- Matthias -
|