Re: [DIFF] strftime() style time formatting for #log command
Malachi Clark <[email protected]> Mon, 16 Jan 2006 11:05:36 -0800
| Newsgroups | gmane.comp.games.mud.client.lyntin |
|---|---|
| Message-ID | <[email protected]> |
While I welcome the new change (thank you), keep in mind that you can do:
#log {$LOGTIMESTAMP.txt}
I have it placed in my startup file, which, in effect, starts a new
logfile for each session. With a nice descriptive filename.
Thanks again.
Ossi Herrala wrote:
>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.
>
>
>
>
>------------------------------------------------------------------------
>
>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")
>
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click