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
➜ Bug reports
➜ Multiple problems with OpenLog
|
Multiple problems with OpenLog
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Vincitore
(11 posts) Bio
|
| Date
| Wed 23 Feb 2011 11:48 PM (UTC) |
| Message
| I'm trying to create an alias to open a log, get some information, and close the log. It doesn't work, though, although there's no problem with opening the log manually--just with OpenLog.
Here's an alias I wrote for testing:
OpenLog ("test.txt", true)
Note(IsLogOpen())
SetLogOutput (true)
Note(GetLogOutput ())
SetLogInput (true)
Note(GetLogInput ())
Send ("do look,hop")
WriteLog("--- Message for the log file ---")
CloseLog()
FlushLog()
And here's what it appends to test.txt:
true
true
true
--- Message for the log file ---
I see the output for "do look,hop" in the game window, but it isn't appended to the file.
Also, OpenLog ignores the chosen log directory. In XP it would save stuff in the Start Menu folder, for some reason, and in Windows 7 it saves in C:\Mushclient. Trying to set a relative or absolute path fails entirely; I get "false" for IsLogOpen. I don't really care about this part, since I can figure out where to find the files... but not being able to log game output (unless I manually open the log) is a pain. Is this a problem with OpenLog or with something I'm doing? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Thu 24 Feb 2011 01:13 AM (UTC) |
| Message
| Well let's see...
- If you don't specify a path name it opens files in the "current directory" whatever that is. You might want to try:
OpenLog (GetInfo (58) .. "test.txt", true)
Where GetInfo (58) is the default log files directory.
- You need to flush the log before closing it. Once it is closed it can't be flushed. However closing flushes it anyway. The idea of flushing is to force out half-filled blocks in case of a crash, so you might do that every 5 minutes or so.
- Your script executes completely before MUSHclient processes more input. Thus it may have sent "do look,hop" to the MUD, but it hasn't got the reply back yet. And then you closed the log file before it did.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Vincitore
(11 posts) Bio
|
| Date
| Reply #2 on Thu 24 Feb 2011 10:51 PM (UTC) Amended on Fri 25 Feb 2011 12:55 AM (UTC) by Vincitore
|
| Message
| Right on all accounts! Changing it as follows, all behaviors are as expected.
require "wait"
wait.make (function ()
OpenLog (GetInfo (58) .. "test.txt", true)
Note(IsLogOpen())
SetLogOutput (true)
Note(GetLogOutput ())
SetLogInput (true)
Note(GetLogInput ())
Send ("do l,hop")
WriteLog (os.date ("%d %b %y %I:%M %p"))
wait.time (1)
CloseLog()
Note "Log closed."
end)
| | Top |
|
| Posted by
| Baatti
USA (7 posts) Bio
|
| Date
| Reply #3 on Sun 17 Apr 2011 09:56 PM (UTC) |
| Message
| I'm having a problem with logging from a plugin, using OpenLog().
I have this trigger:
<triggers>
<trigger
enabled="y"
match="^$"
omit_from_log="y"
omit_from_output="y"
regexp="y"
sequence="100"
>
</trigger>
</triggers>
This trigger's job is to gag blank lines after every prompt. If I use: FILE>LOG SESSION this trigger works, i.e. no blank lines show up in my log file.
However when I initiate a logging session via OpenLog(), I'm logging all of my blank lines. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Sun 17 Apr 2011 11:08 PM (UTC) |
| Message
| | I don't see why that should happen. Once the log file is open, logging is done the same way, regardless of how you opened it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Vincitore
(11 posts) Bio
|
| Date
| Reply #5 on Mon 18 Apr 2011 12:56 AM (UTC) |
| Message
| | The solution to my path problem was to stop trying to use backslashes. Forward slashes work, as though the file path were an internet address. Odd, but easy enough to deal with once the issue is known. | | 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.
20,551 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top