mIRC Homepage
Posted By: LethPhaos timestamping - 08/09/05 01:13 PM
Hello all,

I would like to use a different timestamp in the logs than in the windows.

Is this possible in any way?

EDIT: I suppose it should be moved to scripting help because I relooked the options and couldn't find anything.
Posted By: Im2good4u Re: timestamping - 08/09/05 05:18 PM
well i gues u could write your own logs or overwrite the normal logs whit our own format :tongue:
Posted By: LethPhaos Re: timestamping - 09/09/05 12:51 PM
i guess yes

any more specific hints or help?
Posted By: Riamus2 Re: timestamping - 09/09/05 01:29 PM
If you really feel the need, you can disable logging and use a script to write the logs. You can then format things in whatever way you want. I'm guessing this will be more time consuming than using the built in logging, but I don't know for certain.

To write your own log files:
Code:
on *:text:*:*: {
  write $+($chan,.,$network,.,$date(yyyymmdd),.log) $+([,$time(hh:nntt),]) $+(<,$nick,>) $1-
}


You can easily change the $time format if you want. And, if you don't like that format for the filenames, you can change that as well.

Filename format is:
#channel.network.date.log
#Invision.IrcHighway.20050908.log

I'd recommend not logging all channels... this script will log all channels and queries and chats the way it is right now. You may want to limit it to just specific channels. That's up to you.
Posted By: LethPhaos Re: timestamping - 09/09/05 05:05 PM
will an on text log everything? topics that change and actions, in fact everything, like real logging, should be logged.

will i have to add the same line with on action and on topic (if exists)?
Posted By: Riamus2 Re: timestamping - 09/09/05 05:15 PM
Yes, you'll need to use the same idea for all events you want logged.

The same basic type of format can be used for the events, with only a few changes depending on the format of the event.

Events to consider including:
Text
Action
Join
Part
Quit
Input
Nick
Notice (maybe)
Mode (this includes topic changes... just output the $1- and it should appear correctly)

Just change the write line so it looks the way you want. Basically, you need to change only this section of the write line: $+(<,$nick,>) $1-

The rest should stay the say for that line.

As an example, for actions, you'd change that part to:
* $nick $1-

(and perhaps add the color you use for actions).

As a final note... for the ON INPUT event, you need to manually do your own actions/nick changes/modes/etc because you won't trigger from the other events.

Example:
Code:
on *:input:*: {
  if ($1 == /me) { do the action output ... don't forget to use $me instead of $nick }
  elseif ($1 == /nick) { do the nick output }
  elseif ($1 == /mode) { do the mode output }
}



*****NOTE: I just realized that the format I used for the /write command will only work if you're logging a channel. Here's an updated way to do it:

Code:
on *:text:*:*: {
  if ($chan != $null) {
    write $+($chan,.,$network,.,$date(yyyymmdd),.log) $+([,$time(hh:nntt),]) $+(&lt;,$nick,&gt;) $1-
  }
  else {
    write $+($nick,.,$network,.,$date(yyyymmdd),.log) $+([,$time(hh:nntt),]) $+(&lt;,$nick,&gt;) $1-
  }
}


That will use the nick in the log's filename instead of the channel if the text is in a query/chat/fserv/etc window. Note that for the on input event, you can use the original method, by just replacing $chan with $target .
Posted By: Kelder Re: timestamping - 09/09/05 11:18 PM
Topic changes are not captured with on MODE afaik.

As for the on input script: /topic, /quit, /join, /part, /mode and /nick will have their normal events triggered even if you do the command, since the server sends those back. That leaves /msg, /me, /ame, /amsg, /describe and /echo and for those it seems best to make a custom alias that handles the logging.

alias say { say $1- | write $+($active,.,$network,.,$date(yyyymmdd),.log) $+([,$time(hh:nntt),]) $+(<,$nick,>) $1- }
alias msg { msg $1- | write $+($1,.,$network,.,$date(yyyymmdd),.log) $+([,$time(hh:nntt),]) $+(<,$me,>) $1- }
etc...

btw, the below line is valid, but handled incorrectly in your on INPUT script:
/// msg $me I sent this to myself!

The on INPUT is still needed though, but only for lines not starting with /:
Code:
on *:INPUT:*:{
  if ((/* iswm $1) &amp;&amp; (!$ctrlenter)) return
  say $1-
  halt
}

(Yes I should get the alternate command character too, I never found anyone actually using it))
© mIRC Discussion Forums