Red Eclipse Logging Trick

Red Eclipse Logging Trick

Postby ZeroKnight » 16 Jan 2012, 02:09

Hey guys, I have a little batch file hack here that involves Red Eclipse logging. For those of you that don't know, every time you launch Red Eclipse, everything that gets output to the console and chat console gets logged to a text file in the Red Eclipse home directory.

I like having an archive of logs, so I added this to my redeclipse.bat file:

--NOTE-- THIS DOES NOT WORK ON LINUX, AS BASH HAS DIFFERENT SHELL CODE. PLEASE SEE ARAND'S POST BELOW.
{l Code}: {l Select All Code}
rem -- ZeroKnight Log Hack --
@for /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do @(
set notused=%%A
set month=%%B
set day=%%C
set year=%%D
set fulldate=%%B-%%C-%%D
)
@for /F "tokens=1,2,3,4 delims=:." %%A in ('echo %TIME%') do @(
set hour=%%A
set minute=%%B
set second=%%C
set notused=%%D
set fulltime=%%A.%%B.%%C
)
set LOGNAME=%fulldate%_%fulltime%.txt
rem -- END ZeroKnight Log Hack --

rem set SDL_VIDEO_WINDOW_POS=0,0
set RE_DIR=.
set RE_OPTIONS=-glogs/%LOGNAME% -r


That shell code could probably be better written, but for here's an explanation for those who do not understand. What it does is grab the system's current date and time, and make that the name of the log file, and they all go inside a folder called "logs" inside the home folder.
The log naming scheme is: MM-DD-YYYY_HH.mm.SS.txt

Where M is Month, D is Day, Y is Year, H is Hours, m is Minutes, and S is Seconds.

So, for example, you could have "01-15-2012_19.38.13.txt" as one of your logs. The cool part about this, is that every time you start Red Eclipse, a new log file will be created, since the time will always be different :) With this method, you can have an archive of logs, through any number of startups. This is good for anyone who likes logging information, and especially for server admins who don't have access to the local server.

Enjoy, guys! Just be sure to delete old logs every now and again, otherwise you'll accumulate quite a lot of disk space to these logs :P
Last edited by ZeroKnight on 24 Jan 2012, 20:34, edited 1 time in total.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Red Eclipse Logging Trick

Postby arand » 16 Jan 2012, 04:11

Since I'm bored, I'll ninja:
{l Code}: {l Select All Code}
LOGDIR="logs"
LOGNAME=$(date -I)_$(date +%T).log
RE_OPTIONS="-r -g$LOGDIR/$LOGNAME"

(Not Tested.)
I think something like that should do pretty much the same for *NIX, log rotation should be added I guess, though that would include making sure not compressing or deleting the currently in-use log, and... nah, aint bovverd.

EDIT: -g needs a relative path from $HOME/.redeclipse/, updated script accordingly.
Last edited by arand on 11 Mar 2012, 16:32, edited 2 times in total.
User avatar
arand
 
Posts: 211
Joined: 26 Mar 2011, 21:42

Re: Red Eclipse Logging Trick

Postby ZeroKnight » 24 Jan 2012, 20:37

I echo'd LOGNAME inside of cygwin, and it shows up as a valid filename :)

{l Code}: {l Select All Code}
$ echo $LOGNAME
2012-01-18_17:27:06.log


Thank you, arand. :)
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Red Eclipse Logging Trick

Postby Fallen » 11 Mar 2012, 16:31

Here's my version (sorry, I'm noob, but maybe someone want's to see that I'm not only playing 24/7 :P):
{l Code}: {l Select All Code}
#!/bin/sh
#uncomment that line and enter your RedEclipse location or redeclipse/bin/ if you use just unpacked version and want to have this script on another location that /redeclipse/bin/ (like direcly downloaded from sourgeforge etc.).
#cd ~/data/redeclipse/bin/
#change to "redeclipse" instead of "./reclient_linux_32" if you have installed RE from repo etc, if not make sure that it's correct version (reclient_linux_32/reclient_linux_64/reclient). You can change ~/data/redeclipse/log/ to location where you want log files to be stored - MAKE SURE that this location EXIST before launching, this script will NOT create this location for you!.
./reclient_linux_32 | tee ~/data/redeclipse/log/`date +"%Y-%m-%d_%H:%M:%S"`_RedEclipse.txt
Last edited by Fallen on 11 Mar 2012, 16:38, edited 1 time in total.
Sentenced to the Eternal Damnation...

BloodFrontier...

+++ Sorry for my English +++
User avatar
Fallen
 
Posts: 85
Joined: 26 Feb 2012, 20:45
Location: Poland

Re: Red Eclipse Logging Trick

Postby arand » 11 Mar 2012, 16:35

Just to note, since it was discussed briefly in IRC, in order to place the logs in a custom place and not somewhere below the home dir, you could also use
{l Code}: {l Select All Code}
LOGDIR="/tmp/logs"
LOGNAME=$(date -I)_$(date +%T).log
RE_OPTIONS="-r 2>&1 1>$LOGDIR/$LOGNAME"


In either redeclipse.sh for a tarball version or /[bin,games]/redeclipse in the installed version
User avatar
arand
 
Posts: 211
Joined: 26 Mar 2011, 21:42

Who is online

Users browsing this forum: No registered users and 1 guest