#39 closed task (fixed)
logging: format strings are goofy
Reported by: | Brian Warner | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 0.2.3 |
Component: | logging | Version: | 0.2.2 |
Keywords: | Cc: |
Description
I should have just followed Twisted's lead w.r.t. flogging format strings. The goal is to allow at least these two forms:
log.msg("blah")
log.msg("blah %s", posarg)
(twisted doesn't offer the second, but I think it's handy).
The other goal is to allow kwarg formatting. Twisted does log.msg(format="blah %(n)d", n=12)
,
but I went with log.msg("blah %(n)d", n=12)
. The problem with my approach is that it means
you can't tell if the user really wanted string formatting or not, so log.msg("100% done!")
causes a ValueError? or something as the percent-space format key is bogus.
Switch to the Twisted approach. Then, only apply formatting if there are positional args, or if we have format= instead of message=. Note that this means not all events will have message=, so other code must be prepared to handle this.
Change History (2)
comment:1 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 Changed 17 years ago by
Milestone: | undecided → 0.2.3 |
---|
This is fixed, in [f21098749f883582f58830c1192b80702483fb96].