| View previous topic :: View next topic |
| Author |
Message |
Quackers
Joined: 22 Mar 2008 Posts: 31
|
Posted: Thu Apr 03, 2008 2:54 pm Post subject: Timestamps |
|
|
I'd like to see tintin have the ability to timestamp text in the scrollback buffer and in logs. (And yes, I can come up with a kludge to timestamp anything being logged.)
I'd like to be able to type "#config timestamp on" then #grep something (or page through the scrollback) and have the output prepended with timestamps for each line. Then "#config timestamp off" to return to normal behavior. This approach would easily allow logfiles to have timestamps as well. Ideally, some variable like $timestampformat would allow a user to customize the date/time display.
| Code: |
#config timestamp on
#grep tell
############################ GREP tell ############################
[12:50:43 PM] Nathan Explosion tells you, 'Timestamps are intense.'
###################################################################
#config timestamp off
#grep tell
############################ GREP tell ############################
Nathan Explosion tells you, 'Timestamps are intense.'
###################################################################
|
|
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Thu Apr 03, 2008 4:29 pm Post subject: |
|
|
I'm kind of on the fense about this one.
I'll look into adding an event that triggers on each received line. That'd at least make creating a custom logging script easier. |
|
| Back to top |
|
 |
moebius
Joined: 27 Jan 2005 Posts: 96
|
Posted: Sun Nov 09, 2008 9:37 pm Post subject: |
|
|
I'd really like to see this too. You really lose a lot of information when reading a log or scrollback when you don't know what lines arrived at the same time. _________________ StrangeMUD - strangemud.net:9332 |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Sun Nov 09, 2008 11:23 pm Post subject: |
|
|
Following will work the next release:
| Code: |
#event {RECEIVED LINE}
{
#format time %T;
#format result {%t-%m} {{$time} {$time % 60}};
#line log mylog.txt {<178>$result \};
#line log mylog.txt
}
|
Doesn't work with #grep, but currently the scrollback buffer is hashed (which can save a lot of memory) which isn't possible with timestamps.
Last edited by Scandum on Fri Nov 21, 2008 10:05 am; edited 1 time in total |
|
| Back to top |
|
 |
moebius
Joined: 27 Jan 2005 Posts: 96
|
Posted: Thu Nov 20, 2008 10:56 pm Post subject: |
|
|
Won't that just log timestamps to a separate file? I'm looking for timestamps on your normal log file. _________________ StrangeMUD - strangemud.net:9332 |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Fri Nov 21, 2008 10:44 am Post subject: |
|
|
| Guess I can make it a hidden config option where it's disabled if left blank, and enabled if you enter a timestamp format. |
|
| Back to top |
|
 |
moebius
Joined: 27 Jan 2005 Posts: 96
|
Posted: Fri Nov 21, 2008 3:08 pm Post subject: |
|
|
That's more of what i was hoping for. Something like
| Code: | | #CONFIG log_timestamp "%Y-%m-%d %H:%M:%S" |
(standard /bin/date formatting options)
Then your log shows:
| Quote: | 2008-11-20 13:01:00 You nod.
2008-11-20 13:01:00 >
2008-11-20 13:01:04
2008-11-20 13:01:04 Fred walks into the room.
2008-11-20 13:01:04 >
2008-11-20 13:02:25
2008-11-20 13:02:25 Fred leaves.
2008-11-20 13:02:26
2008-11-20 13:02:26 You say 'Hey Fred!'
2008-11-20 13:02:26 >
2008-11-20 13:02:28
2008-11-20 13:02:28 Joe laughs.
2008-11-20 13:02:28 >
2008-11-20 13:02:31
2008-11-20 13:02:31 Joe says, 'just missed him! ' |
Then by default you could have the timestamp format be "" and the output would be same as it is now. _________________ StrangeMUD - strangemud.net:9332 |
|
| Back to top |
|
 |
tarryn
Joined: 06 Jun 2009 Posts: 2
|
Posted: Sat Jun 06, 2009 4:50 pm Post subject: |
|
|
This pretty easily accomplished with something like this: (slight variation on Scandum's version)
Prerequisite: capture the name of your current log file in a variable ($logfile).
Then create an event like this:
| Code: | #event {RECEIVED LINE}
{
#format totalmicrosec %U;
#math microsec {($totalmicrosec % 1000000) / 100};
#format timestamp {%t.%%04d} {{%H:%M:%S} {$microsec}};
#line log {$logfile} {$timestamp \};
} |
which will prefix "HH:MM:SS.mmmm " before every log line. |
|
| Back to top |
|
 |
|