Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ A few things about logs

A few things about logs

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Zalethon   USA  (13 posts)  Bio
Date Sun 05 Nov 2006 03:49 PM (UTC)
Message
I like to log all my games I play, and it can get kind of tedious having to enter all the information again and again in the logging section.. The first thing I'd like to suggest would be an addition to the logging section in global preferences, allowing you to set a default. Also it might be nice to have it prompt you if the folder it attempts to write in (in this case it was %N for the name of the game) doesn't exist, and allows you the option of having it created. Another suggestion really concerns scripting, there's a function to write to the log file, but perhaps there could be a function for writing to a separate log file? This could be used for things like logging IC and OOC in different logs.

Overkill is better than underkill.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 05 Nov 2006 08:22 PM (UTC)
Message
Quote:

... it can get kind of tedious having to enter all the
information again and again in the logging section ...


This is where plugins can be handy. A small plugin that sets things like "log_line_preamble_input" when you open your world, would do the trick. Simply install the plugin and your logs are fixed up! In fact, in global preferences you can make global plugins, so you can automatically have this plugin installed for each new world.

An example plugin would be:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, November 06, 2006, 8:08 AM -->
<!-- MuClient version 3.82 -->

<!-- Plugin "LogFileFixup" generated by Plugin Wizard -->

<muclient>
<plugin
   name="LogFileFixup"
   author="Nick Gammon"
   id="e5e25c8f3f4eedbd9a32e5b2"
   language="Lua"
   purpose="Changes logging preambles, etc."
   date_written="2006-11-06 08:05:10"
   requires="3.52"
   version="1.0"
   >

</plugin>


<!--  Script  -->


<script>
<![CDATA[
function OnPluginInstall ()
  if GetAlphaOption ("log_line_preamble_input") == "" then
    SetAlphaOption ("log_line_preamble_input", "mypreamble> ")
  end 
end -- OnPluginInstall

]]>
</script>


</muclient>


In this plugin I am changing the preamble to "mypreamble> " if it is currently empty. You could change other things, such as:


log_file_postamble
log_file_preamble
log_line_postamble_input
log_line_postamble_notes
log_line_postamble_output
log_line_preamble_input
log_line_preamble_notes
log_line_preamble_output


Quote:

Also it might be nice to have it prompt you if the folder it attempts to write in ... doesn't exist


You could also do this in the plugin. Some code like this could do it:


if ChangeDir ("\\mylogdirectory") == 0 then
  os.execute ("mkdir \\mylogdirectory")
  Note ("Creating directory \\mylogdirectory")
end -- directory not existing


This attempts to change to the log directory, and if that fails, it must not exist, so it uses os.execute to make it. You would need to trust your plugin in the Lua sandbox or the attempt to use os.execute will fail.

Quote:

Another suggestion really concerns scripting, there's a function to write to the log file, but perhaps there could be a function for writing to a separate log file?


You can script any number of log files, by simply making a trigger to catch the appropriate lines (eg. "IIC: *") and then call a script that simply writes to a file (using Lua io functions, for example). Then you simply make sure that your plugin opens the file when the world is connected (OnPluginConnect) and closed when the world is disconnected (OnPluginDisconnect).

So really, one plugin (like the one I presented earlier, but with a few additions) could handle all of that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Zalethon   USA  (13 posts)  Bio
Date Reply #2 on Sun 05 Nov 2006 09:08 PM (UTC)
Message
K.. Thank you for the suggestions

Overkill is better than underkill.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


13,586 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.