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
Conversation
Using timeBuffer list, which is avaiable even when Show Time Stamps is turned off. Both for html and txt log formats.
Thanks for the improvement! I'll test it out. |
There was a problem hiding this 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() ) |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
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.
I checked the generated HTML logs with https://validator.w3.org/ |
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. |
@gpalino what you've got so far looks great. |
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.
Now it should be finished from my point of view, I've fixed copy HTML behaviour. |
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. |
I've extended also void TTextEdit::copySelectionToClipboard(), to add timestamps to plain copy. |
There was a problem hiding this 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! 💯
Merging this in as @SlySven's review comments have been addressed - would like this in the 3.1 release. |
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>
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>
Using timeBuffer list, which is avaiable even when Show Time Stamps is turned off.
Both for html and txt log formats.