[DIFF] strftime() style time formatting for #log command
Ossi Herrala <[email protected]> Mon, 16 Jan 2006 21:06:18 +0200
| Newsgroups | gmane.comp.games.mud.client.lyntin |
|---|---|
| Message-ID | <[email protected]> |
Hello list,
The following simple patch makes it possible to use strftime() style
formatting with #log command. This is way it's possible to start
logging automatically and have logs nicely ordered for example per day
basis.
> #log testi-%Y-%m-%d.log
lyntin: log: starting logging to '/home/oherrala/testi-2006-01-16.log' stripping ansi.
Ps. wiki doesn't seem to work.
Warning: Variable passed to each() is not an array or object in
/home/groups/l/ly/lyntin/htdocs/phpwiki/lib/dbalib.php on line 56
WikiFatalError
Cannot open database 'wiki' : '/home/groups/l/ly/lyntin/pages/wikipagesdb', giving up.
Pps. it would be cool to see a new release. Last one is from year 2004.
--
Ossi Herrala, OH8HUB
PGP: 0x78CD0337 / D343 F9C4 C739 DFFF F619 6170 8D28 8189 78CD 0337
Hi! I am a .signature virus. Copy me into your .signature to join in!
logger.diff
(text/plain, 1.2 KB)
Index: lyntin/modules/logger.py
===================================================================
RCS file: /cvsroot/lyntin/lyntin40/lyntin/modules/logger.py,v
retrieving revision 1.8
diff -u -r1.8 logger.py
--- lyntin/modules/logger.py 18 Jan 2004 15:19:54 -0000 1.8
+++ lyntin/modules/logger.py 16 Jan 2006 18:56:47 -0000
@@ -12,6 +12,7 @@
Logging can be turned on and shut off on a session by session basis.
"""
import string, os, thread
+from time import strftime
from lyntin import ansi, manager, config, utils, exported, constants
from lyntin.modules import modutils
@@ -268,6 +269,8 @@
Will start or stop logging to a given filename for that session.
Each session can have its own logfile.
+ FILENAME may contain strftime() format string.
+
If USERPREFIX is set, then every line from the user will be
prepended with this prefix and immediately written into log file.
If USERPREFIX is omitted, then the user input will be attached to
@@ -304,7 +307,7 @@
# handle starting logging
try:
if os.sep not in logfile:
- logfile = config.options["datadir"] + logfile
+ logfile = config.options["datadir"] + strftime(logfile)
if databuffer:
f = open(logfile, "w")