On Oct 25, 2010, at 02:28 PM, Vinay Sajip wrote: >I've just checked in a change to logging into the py3k branch (r85835), >including doc changes and tests, for providing slightly more flexibility in >alternative format styles for logging. > >Basically, Formatter.__init__ gets an extra optional keyword arg style=<one of >'%' (default), '{' or '$'>. This is then used to merge the format string with >the LogRecord: either fmt % record.__dict__, or fmt.format(**record.dict), or >string.Template(fmt).substitute(**record.dict). Backward compatibility is >maintained (unless I've missed something).
This sounds like a reasonable solution that provides the flexibility we want, while maintaining backward compatibility. Thanks! I haven't played with it yet, but do you think it makes sense to add a 'style' keyword argument to basicConfig()? That would make it pretty easy to get the formatting style you want without having to explicitly instantiate a Formatter, at least for simple logging clients. Cheers, -Barry
signature.asc
Description: PGP signature
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com