<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000">Christopher Armstrong
wrote:
<blockquote type="cite">
<pre wrap="">logger.msg("scheduled-compaction-failed")
</pre>
</blockquote>
I'm confused. You don't want to use English, but… why not change your
hyphens to spaces and call it a day? Also, why did it fail?<br>
<br>
Here's a fuller example, modified to fit the API I'm using:<br>
<br>
<div style="margin-left: 40px;"><span><pre wrap="">from twisted.python.log import Logger
log = Logger()
try:
scheduleCompaction(…)
except Exception as e:
log.error("Scheduled compaction failed: {why}", why=e,
id=2C09A260-184C-44F9-B11F-E12B26B26C9C)</pre></span></div>
<span><br>
Some things to note about this:<br>
<br>
- `log = Logger()` does some magic so that log.namespace is the name
of your module "spacecombat.server.db". So, your "system" identifier is
perhaps covered by that, with no typing.<br>
</span><br>
- I have a format string instead of a fixed string. An observer
emitting text can emit something informative. I know you think that
text logs aren't useful, but a lot of us do. And you can use observers
that ignore this format. Maybe there's an argument for making the
format optional...<br>
<br>
- Formatting isn't done here, so... cheap if you don't use it in any
observers.<br>
<br>
- I added a GUID id argument since you seem keen, I think on a unique
key to identify the code point at which the message is logged. It's not
used in the format, but an observer storing things in a DB could use
that to take you straight to the relevant code, or identify multiple
instances of that message, etc. if the format string isn't how you want
to do that.<br>
<br>
-wsv<br>
<br>
</body></html>