[FEATURE] Add timestamps to logs that don't support them #3778
Labels
command: console
command: mods
command: start
distro: Debian
info: tmux
type: feature request
New feature or request
Milestone
User Story
As a server admin, I want to be able to view timestamps for my server logs.
Basic info
Implementation
I have tried to implement this after interacting with the Github mods gentlemen on Discord.
I have found that we can prepend all lines of log with the timestamp by modifying these lines:
LinuxGSM/lgsm/functions/command_start.sh
Line 95 in fdfeae1
LinuxGSM/lgsm/functions/command_start.sh
Line 111 in fdfeae1
Should be changed to:
With a global variable (using
gawk
for readability)Or without gawk we can just put this script in a one liner:
I tested this on my rustserver, and the output:
Becomes:
I didn't add a check to manage lines with whitespaces because that would make the code too complex and unreadable.
We can also use
ts
frommoreutils
package but it adds dependencies:We can also add a global variable to activate timestamps on certain games, not all. And a variable for the format.
Although this solution is not ideal, because the timestamp won't be precise for every line, but each time tmux dumps logs to the file, every line included in that dump will have the same timestamp of the moment the dump occurs. It still is much better than no timestamps at all in my opinion.
I'd like your feedback on this. Would you like something like this to be included in your code? Do you think there is something else I should add for this to be included in your codebase?
I'd like your feedback on this.
The text was updated successfully, but these errors were encountered: