On 7/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Thu, Jul 20, 2006 at 11:39:27AM -0400, Jim Jewett wrote:
> > Even SysLogHandler.emit doesn't actually print the string; it is only > > used as a lookup key for a dictionary whose keys are all lower-case > > ASCII. In theory, you could monkey-patch that dictionary to add > > additional values, but then you might as well subclass to do the right > > thing with your new keys. (It *might* make sense to change the base > > function and dictionary to accept unicode, including undotted-i > > synonyms.) > My initial approach was to compute the values of the dictionary based on the > current locale - and that doesn't work. Correct, it would need to be done by hand. As part of the current class construction, SysLogHandler.priority_names["info"] = SysLogHandler.LOG_INFO You could add other entries, so that SysLogHandler.priority_names["my_info"] = SysLogHandler.LOG_INFO If you also changed SysLogHandler.encode_priority to accept unicode keys, you could even add u"info" and the equivalent with an undotted-i. I'm not sure this is worth doing, though, since they supposedly represent symbolic constants. -jJ > The issue is not that the dictionary doesn't accept unicode, it's that there's > no reliable way to do lookups in it. If you could sketch an example of what > you had in mind with the monkey-patching, please do so, since I don't think I > grasped the idea. > > Misa > _______________________________________________ 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