Daily Log

Posted by Grimsbeard on Sat 05 Sep 2009 09:14 AM — 18 posts, 80,600 views.

#0
I have seen a couple of really old forums about it but I simply cannot make heads or tails.

What I want to do is have folders per world.... and in that folder a new log file is started every day at 00:00:01 under the X Day of Y Month in Z Year.

How? :D

ps. Been using MUSHclient since it was waaaay old. Thanks :D
#1
My understanding of the log system is that you configure the world file to log to a file that can contain the current date and time etc. When the world connects every thing will be logged to this file. I'm not sure about MUSH creating a new file at midnight, I'm pretty sure it's per session. So I think this would require a simple script to start and stop logging when the date changes.
#2
Pretend I am a retard when it comes to code and scripting.... trust me, I am not far from it.

Someone got something on their client to suitably match the need?
#3
I have Game -> Configure -> Logging configured to log to this file:

C:\Program Files\MUSHclient\logs\%d.%b.%y_Command_Window.html

This creates a file with the name:

C:\Program Files\MUSHclient\logs\31.Aug.09_Command_Window.html

So each time MUSH is started the log is appended of or a new one created with current date and time.

For my chat window I have to manually select Log Session from the file menu each time I start MUSH, I think this is because MUSH starts logging on world connect.

I don't think the you really need to script this MUSH will write the log file with the date for each day.

Here is a picture of my log dialog:
http://picasaweb.google.com/lh/photo/bgGiB_1L2wLiruQ2ZaX8uA?feat=directlink

Australia Forum Administrator #4
There are other things you can put in the log file name, such as the world name. See:

http://www.gammon.com.au/scripts/doc.php?dialog=IDD_PREFS_P4

You could make each world have its own subdirectory, however it won't create the subdirectory for you. You would have to manually make a subdirectory per world, and then the logs for that world could go in it. eg.


C:\Program Files\MUSHclient\logs\%N\%d.%b.%y_world_log.txt


The %N would be expanded to the current world name.
#5
Thanks guys and thanks Nick, you have always answered every question I ever had... (usually vis-a-vis email back in the day under a different email lol).

Thanks a bunch.
#6
Oh and that string you suggested, Nick, this would need me to manually reconnect, yes? I have a staff bit on one MUSH and well, I never disconnect with him :P
Australia Forum Administrator #7
What you can do is add a timer like this:


<timers>
  <timer 
    name="Reopen_Log" 
    enabled="y" 
    hour="1"  
    send_to="12"
>
  <send>

CloseLog ()
OpenLog ("", true)

</send>

  </timer>
</timers>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


That will close and re-open the log every hour (if you are connected). Thus, it will tick over at midnight (or sometime in the next hour afterwards), closing the current log file and opening a new one. It will use the current log file string if you supply an empty string to OpenLog, and thus it will respect the date/time codes in it. During the day it will append to the existing log file, so you won't get lots of different files in one day.
USA #8
In case this helps anyone, this is what I use to log unique files every time.

logging = function (mode)
  if (mode == "on") then
    local logname = GetInfo (66) .. [[logs\Trevize ]] .. os.date("%d-%m-%y ")
                   .. string.format ("%08i",math.random (1, 99999999)) .. ".html"
    OpenLog (logname)
    WriteLog ("<html>")
    WriteLog ("<head>")
    WriteLog ("<title>MUSHclient Log - Trevize Moonflair</title>")
    WriteLog ("</head>")
    WriteLog ("<body>")
    WriteLog ('<table border=0 cellpadding=5 bgcolor="#000000">')
    WriteLog ("<tr><td>")
    WriteLog ('<pre><code><font size=2 face="FixedSys, Lucida Console, Courier New, Courier">')
    Note ("Logging to " .. logname)
  else
    if IsLogOpen() then
      Note ("Stopped logging")
      WriteLog ("</font></code></pre>")
      WriteLog ("</td></tr></table>")
      WriteLog ("</body>")
      WriteLog ("</html>")
      CloseLog ()
    end -- if
  end -- if
end -- func


I just have a ^log (on|off)$ alias that calls logging (string.lower("%1")).
Amended on Mon 07 Sep 2009 02:43 AM by Fadedparadox
#9
Nick, I get:

Line 1: Tag not used: <timers> ()

When I try and use the timer script.
Australia Forum Administrator #10
Did you paste it into the Timers configuration?
#11
Yup
Australia Forum Administrator #12
It worked for me when I pasted it into the Timers configuration. The instructions in the "how to paste" page are for triggers not timers. If you follow those literally you will see the message:


Line    1: Tag not used: <timers> ()


You need to switch to the Timers part of world configuration, not the Triggers part. The instructions given showed triggers as an example.
#13
*sighs* Yup. I am a bonehead.

I'll post again when it hits midnight in Canuckistan and tell you if it works... hah.
#14
That worked Nick. Thanks.

Remember ....... Timers, not triggers people. *siiigh*
Finland #15
Awesome, I didn't realise that it'd be as simple as setting tags to the filename! Magnificent!
Finland #16
Okay, here's another one.

I figured out (thanks to this post) how to automate my log dividing into smaller parts (through the timetags in the filename), but still I manage to get files as big as 4megs or so (which is way too big).

So I made a timer that simply does a CloseLog and an OpenLog. It works fine, but it doesn't throw in the HTML start and end tags (i'm logging in .html).

My question is, how can I get those tags into the log?
Finland #17
I checked out Fadedparadox's timer and there it was, the answer right infront of my eyes! I guess I need to stop to be affraid of difficult looking scripts :)