Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance: added timestamps to log file. #984

Merged
merged 5 commits into from May 3, 2017

Conversation

gpalino
Copy link
Contributor

@gpalino gpalino commented May 1, 2017

Using timeBuffer list, which is avaiable even when Show Time Stamps is turned off.
Both for html and txt log formats.

Using timeBuffer list, which is avaiable even when Show Time Stamps is turned off.
Both for html and txt log formats.
@vadi2
Copy link
Member

vadi2 commented May 1, 2017

Thanks for the improvement! I'll test it out.

Copy link
Member

@SlySven SlySven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a useful suggestion - but I am not sure that everyone will want time stamps in logs of the main (or if applicable, I am not sure it is, in:) other consoles.

There are two separate things that can generate "logs":

  • the Lua command or main console bottom button that turns it on for the main console (next to the ones that controls the appearance of screen of the time-stamps that we are attempting to duplicate in a file here and the one that controls the recording of a file that can later be played back to "exercise"/"test" the whole setup's response to data from the MUD server {i.e. the "Replay" one})
  • manual selection of the text and then using the right-click (context) menu options to "copy" or "copy as HTML".

Does this change work on one or both things?

tl;dr; Is (or can) there (be) a way to control the inclusion of these time stamps?

src/TBuffer.cpp Outdated
@@ -2400,7 +2400,11 @@ void TBuffer::log( int from, int to )
}
else
{
toLog = lineBuffer[i];
if( !timeBuffer[i].isEmpty() )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't recall the exact details of the timeBuffer but is it empty on wrapped lines or filled with something other than a date-time stamp - possibly some '-'? It may be that we will need to insert 13 spaces to pad things out...

src/TBuffer.cpp Outdated
@@ -3171,6 +3175,14 @@ QString TBuffer::bufferToHtml( QPoint P1, QPoint P2 )
QString fontStyle;
QString textDecoration;
bool firstSpan = true;
if( !timeBuffer[y].isEmpty() )
{
firstSpan = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember firstSpan being true initially is needed to ensure that the CSS is present in the first <span ...> in the created HTML file and to avoid the insertion of a \</span> in the first iteration around the for(...) that follows here... 😟

Actually, further examination suggests this is correct after all! 😀

Example of incorrect alignment:
14:21:34.413 (mapper): The games map was updated - you should update yours! Go to Settings -> Mapper tab and
-----click on the button there. Once you've updated, click here to remove the reminder.hide
@gpalino
Copy link
Contributor Author

gpalino commented May 1, 2017

I've added possibility to turn on/off timestamp logging in Settings -> General; hopefully correctly.

I am not familiar with recording & replaying, so please test it.

"copy as HTML" will probably not work as expected, because depending on Setting related to log files, the timestamp will be either included or not included in html snippet.
What do you think

  • Is this acceptable?
  • Should be timestamp snippets forbidden for "copy as HTML"
  • Should we use setting "Show Time Stamps" (one of bottom buttons) to decide whether to include timestamps or not?

I checked the generated HTML logs with https://validator.w3.org/
As far as I've seen, my changes brought no issues (tested shortly with achaea and aardwolf).
There is just different kind of bug - missing </div></body></html> at the end

@vadi2
Copy link
Member

vadi2 commented May 2, 2017

I think the "Show time stamps" bottom button toggling "copy as HTML" is a good idea, that way people can quickly change if they'd like timestamps in a particular paste or not.

@vadi2
Copy link
Member

vadi2 commented May 2, 2017

@gpalino what you've got so far looks great.

@adayoung
Copy link
Contributor

adayoung commented May 2, 2017

I feel it should copy what is shown on the screen. So if timestamps are visible, it shouldn't be a surprise when the html log also includes timestamps 😁 Thank you for the enhancement!

The setting "Show Time Stamps" is used to determine if timestamps are included or not.
@gpalino
Copy link
Contributor Author

gpalino commented May 2, 2017

Now it should be finished from my point of view, I've fixed copy HTML behaviour.

@vadi2
Copy link
Member

vadi2 commented May 2, 2017

Could you do the same for plain copy - if timestamps are visible, they're added to what is copied?

3.1 release will be tomorrow, and side from this, it looks good from my pov. If we could get this in and approvals @SlySven @ahmedcharles then I'll be happy to get it into the release as it has a small regression footprint.

@gpalino
Copy link
Contributor Author

gpalino commented May 2, 2017

I've extended also void TTextEdit::copySelectionToClipboard(), to add timestamps to plain copy.
I consider it could be annoying sometimes (e.g. I want to quickly copy-paste text from console to input line, regardless of Show Time Stamps setting), so I made a compromise. Timestamps are included only when selecting more than one line of text.

Copy link
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thinking, works great. Thanks! 💯

@ahmedcharles
Copy link
Contributor

I'm good with @SlySven and @vadi2 reviewing.

@vadi2
Copy link
Member

vadi2 commented May 3, 2017

Merging this in as @SlySven's review comments have been addressed - would like this in the 3.1 release.

@vadi2 vadi2 merged commit d332196 into Mudlet:development May 3, 2017
SlySven added a commit to SlySven/Mudlet that referenced this pull request Feb 23, 2019
A recent PR: Mudlet#2365 removed code which
was rendered ineffective by an implementation error in:
Mudlet#984 however it causes an error which
has just been raised in:
Mudlet#2367

This PR should fix the issue and it also fixes another bug that I can see
in that underlines are not being reproduced in the HTML files because of a
typo in that part of the style detail for `<span ...>` entries which used
"text-decoration: undeline" instead of: "text-decoration: underline"!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
SlySven added a commit that referenced this pull request Feb 24, 2019
A recent PR: #2365 removed code which
was rendered ineffective by an implementation error in:
#984 however it causes an error which
has just been raised in:
#2367

This PR should fix the issue and it also fixes another bug that I can see
in that underlines are not being reproduced in the HTML files because of a
typo in that part of the style detail for `<span ...>` entries which used
"text-decoration: undeline" instead of: "text-decoration: underline"!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants