In left4dead and left4dead2, the srcds_run wrapper supports and extra option 
-consolelog. This launches a program called "logger" which is expected to be in 
the bin directory of your install. I never shipped this utility since it was 
something only I was using, and it will not work out of the box since it uses a 
perl module that is not installed by default. But if there is a need for that 
sort of thing, I can share the script with you. It is a Perl Expect script. A 
simple redirection will not work because the srcds_linux writes directly to the 
terminal not stdout. 

The -consolelog option isn't available in the orangebox/CS:S games, but it is 
easy to add this. I have included the code for the "logger" script below. It is 
a very simple wrapper. Make of it what you will. "logger" takes the path to the 
console log as the first argument. The rest of the arguments are assumed to be 
the command you want run. But by doing this, you are giving up the ability to 
interact with the console. That shouldn't be an issue if you have netconn or 
rcon setup, which is the way I interact with our servers. 

#!/usr/bin/perl -w
use Expect;
use File::Basename;
use File::Path;
use strict;

my $log_file = shift @ARGV;
my $log_dir = dirname($log_file);
mkpath($log_dir) unless -d $log_dir;

my $expect = new Expect;
$expect->log_file($log_file);
$expect->spawn(@ARGV);
$expect->expect(undef);
exit($?);


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of f0rkz
Sent: Monday, February 08, 2010 7:55 AM
To: [email protected]
Subject: [hlds_linux] Logging console output

Ok.  I know there is logging built into games using the Log on cvar.
What I need is the actual contents of the console captured to a log
file.  I noticed srcds_run is a shell script that execs another program
so redirecting the output to a log file isn't possible.  Does anyone
have any tricks or scripts to log the output of srcds_run and any of the
exec'd programs under it?

Thanks for your help,

f0rkz


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

Reply via email to