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 ➜ Plugins ➜ New Improved HTML Logging Plugin

New Improved HTML Logging Plugin

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


Posted by Sojik   USA  (8 posts)  Bio
Date Thu 16 Jun 2011 07:56 AM (UTC)
Message
The default HTML color logging annoyed me a bit so I've redone it as a plugin.

Firstly, <font> is being phased out. They want you to use styles instead. I've made sure the html produced in the log is valid (valid XHTML 1.1 to be specific) because it's pretty easy.

Secondly, I thought it'd be better to just log the lines from the MUD directly to the log without splitting them. I do my wrapping in css.

I'll just post what I have and then explain it later when I have more time. Just know you need specific logging settings (uncheck logging commands, notes and output and uncheck color, raw and Write world name to log file). After you do that it's going to ask you if that's what you want to do and you have to say yes (each time you visit that tab).

Here's the preamble (if you know what you're doing you can mess with it):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>LOG:%N-%y/%m/%d %H:%M:%S (%P)</title>
<link rel="stylesheet" type="text/css" href="logstylesheet.css" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<div id="log">


Postamble:
</div>
</body>
</html>


The different line preambles won't do anything with this plugin so you might as well blank those out.

Here's what I recommend for a log file name:
%L\%y.%m.%d.%H.%M.%S %N(%P).html


I'll post the XML in the next post and then what I'm using for CSS.
Top

Posted by Sojik   USA  (8 posts)  Bio
Date Reply #1 on Thu 16 Jun 2011 07:57 AM (UTC)

Amended on Thu 16 Jun 2011 11:28 PM (UTC) by Nick Gammon

Message
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, June 16, 2011, 2:34 AM -->
<!-- MuClient version 4.73 -->

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

<muclient>
<plugin
   name="Improved_HTML_Logging"
   author="Scott Grossman"
   id="5d2f084bf4978af4f49db2b8"
   language="Lua"
   purpose="Improves HTML logging complete with external css support and fully valid XHML standards"
   date_written="2011-06-16 02:32:17"
   requires="4.73"
   version="1.0"
   >

</plugin>


<!--  Get our standard constants -->

<include name="constants.lua"/>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="^.*$"
   name="output"
   regexp="y"
   script="WriteLogInHTML"
   send_to="12"
   sequence="1"
  >
  </trigger>
</triggers>

<!--  Aliases  -->

<aliases>
  <alias
   name="command"
   script="WriteLogInHTML"
   match="^.*$"
   enabled="y"
   regexp="y"
   sequence="100"
  >
  <send>%0</send>
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
function GetAnsiNumber()
    local a = {}
    for i=1,8 do
        table.insert(a, GetNormalColour(i), i)
        table.insert(a, GetBoldColour(i), i+8)
        table.insert(a, 0, 0)
    end
    return a
end

function WriteLogInHTML(name, line, wildcards, styles)
    lino = [[<span title="]]..os.date("%A, %B %d, %Y %I:%M:%S%p")..[[" class="]]..name..[[">]]
    linc = [[</span>]]
    to = [[<span class="]]
    tc = [[">]]
    en = [[</span>]]
    nl = ""
    if name == "output" then
        for i=1,table.maxn(styles) do
            tec = GetAnsiNumber()[styles[i].textcolour]
            bac = GetAnsiNumber()[styles[i].backcolour]
            if tec == 8 then
                tec = ""
            else
                tec = "a"..tec
            end
            if bac == 0 then
                bac = ""
            else
                bac = " b"..bac
            end
            
            sty = ""
            s = styles[i].style

            if s == 1 or s == 3 or s == 5 or s == 7 or s == 9 or s == 11 or s == 13 or s == 15 then
                sty = sty.." b"
            end
            if s == 2 or s == 3 or s == 6 or s == 7 or s == 10 or s == 11 or s == 14 or s == 15 then
                sty = sty.." u"
            end
            if s == 4 or s == 5 or s == 6 or s == 7 or s == 12 or s == 13 or s == 14 or s == 15 then
                sty = sty.." i"
            end
            if s == 8 or s == 9 or s == 10 or s == 11 or s == 12 or s == 13 or s == 14 or s == 15 then
                sty = sty.." r"
            end
            
            tex = FixupHTML(styles[i].text)
            if tec == "" and bac == "" and sty == "" then
                nl = nl..tex
            else
                nl = nl..to..Trim(tec..bac..sty)..tc..tex..en
            end
        end
    elseif name == "command" then
        nl = FixupHTML(line)
    end
    WriteLog(lino..nl..linc)
end


]]>
</script>


</muclient>


[EDIT] Edited by Nick to escape forum codes.
Top

Posted by Sojik   USA  (8 posts)  Bio
Date Reply #2 on Thu 16 Jun 2011 08:00 AM (UTC)
Message
body {
    background-color:black;
    white-space:pre-wrap;
    font-family:monospace;
    width:80ch; /* Adjust this if your browser doesn't support 'ch' */
    font-size:10pt;
}
.command {
    color:rgb(50,205,50);
}
.output {
    color:rgb(192,192,192);
}
.a1 {
    color:rgb(105,105,105);
} /* ANSI colors 1-8 is dark and 9-16 is bright */
.a2 {
    color:rgb(128,0,0);
}
.a3 {
    color:rgb(0,128,0);
}
.a4 {
    color:rgb(128,128,0);
}
.a5 {
    color:rgb(0,0,128);
}
.a6 {
    color:rgb(128,0,0);
}
.a7 {
    color:rgb(0,128,128);
}
.a8 {
    color:rgb(192,192,192);
}
.a9 {
    color:rgb(128,128,128);
}
.a10 {
    color:rgb(255,0,0);
}
.a11 {
    color:rgb(0,255,0);
}
.a12 {
    color:rgb(255,255,0);
}
.a13 {
    color:rgb(0,0,255);
}
.a14 {
    color:rgb(255,0,255);
}
.a15 {
    color:rgb(0,255,255);
}
.a16 {
    color:rgb(255,255,255);
}
.b1 {
    background-color:rgb(105,105,105);
}
.b2 {
    background-color:rgb(128,0,0);
}
.b3 {
    background-color:rgb(0,128,0);
}
.b4 {
    background-color:rgb(128,128,0);
}
.b5 {
    background-color:rgb(0,0,128);
}
.b6 {
    background-color:rgb(128,0,0);
}
.b7 {
    background-color:rgb(0,128,128);
}
.b8 {
    background-color:rgb(192,192,192);
}
.b9 {
    background-color:rgb(128,128,128);
}
.b10 {
    background-color:rgb(255,0,0);
}
.b11 {
    background-color:rgb(0,255,0);
}
.b12 {
    background-color:rgb(255,255,0);
}
.b13 {
    background-color:rgb(0,0,255);
}
.b14 {
    background-color:rgb(255,0,255);
}
.b15 {
    background-color:rgb(0,255,255);
}
.b16 {
    background-color:rgb(255,255,255);
}
.u {
    text-decoration:underline;
}
.b {
    font-weight:bold;
}
.i {
    font-style:italic;
}
.r {
}


You have to name the css file logstylesheet.css and put it in your log directory. Why use an external css? You can edit colors and styles and automatically all of your logs will update.

One downside is if you need to copy from your html logs to post on your website. The classes I'm using won't color or style anything without the css file.
Top

Posted by Sojik   USA  (8 posts)  Bio
Date Reply #3 on Thu 16 Jun 2011 08:05 AM (UTC)

Amended on Thu 16 Jun 2011 08:14 AM (UTC) by Sojik

Message
I have an idea about an alias that'll throw an <a> (anchor) that we can link to into the log.

That way you can type in MUSHclient something like this:
lognote Beginning scene with Charlie


Then that'll log something like
<a id="note123">Beginning scene with Charlie</a>
and then maybe output that into a new HTML document with the links to all my anchors (i.e. file:///C:/Users/Scott/Dropbox/MUSHclient/logs/11.06.16.02.39.05%20R2A%28Ala%29.html#note123 etc.)

EDIT:

The reason I want to add this is to easily find scenes I want to see later. Eventually I'll be making my own local wiki with links to all of my character's scenes so this'll save me alot of time. I hate cleaning roleplay logs.

I used to use the DailyLog plugin and I don't think I will have to anymore with an alias like this.
Top

Posted by Sojik   USA  (8 posts)  Bio
Date Reply #4 on Thu 16 Jun 2011 03:52 PM (UTC)

Amended on Thu 16 Jun 2011 03:54 PM (UTC) by Sojik

Message
I could add to the plugin something that'll automatically make the css file and set the logging settings for you but I'm not sure people want a plugin with os.executes in them.

Although, I may do it anyway because it'd be cool if the CSS file automatically updated itself if I change my color settings in MUSHclient to make them match.
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.


14,459 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.