Revision: 7086 http://playerstage.svn.sourceforge.net/playerstage/?rev=7086&view=rev Author: thjc Date: 2008-10-07 20:08:21 +0000 (Tue, 07 Oct 2008)
Log Message: ----------- make the .player log file optional and configurable Modified Paths: -------------- code/player/trunk/libplayercore/bindings/java/main.java code/player/trunk/libplayercore/error.c code/player/trunk/libplayercore/error.h code/player/trunk/libplayersd/playersd_mdns.c code/player/trunk/libplayertcp/bindings/java/main.java code/player/trunk/libplayertcp/playertcp.cc code/player/trunk/server/drivers/mixed/wbr/914/wbr914.cc code/player/trunk/server/server.cc Modified: code/player/trunk/libplayercore/bindings/java/main.java =================================================================== --- code/player/trunk/libplayercore/bindings/java/main.java 2008-10-07 11:42:58 UTC (rev 7085) +++ code/player/trunk/libplayercore/bindings/java/main.java 2008-10-07 20:08:21 UTC (rev 7086) @@ -54,7 +54,7 @@ // Initialization stuff playercore_java.player_register_drivers(); - playercore_java.ErrorInit(9); + playercore_java.ErrorInit(9,NULL); ConfigFile cf = new ConfigFile(0, 0); Modified: code/player/trunk/libplayercore/error.c =================================================================== --- code/player/trunk/libplayercore/error.c 2008-10-07 11:42:58 UTC (rev 7085) +++ code/player/trunk/libplayercore/error.c 2008-10-07 20:08:21 UTC (rev 7086) @@ -38,10 +38,10 @@ // Initialize error logging void -ErrorInit(int _msgLevel) +ErrorInit(int _msgLevel, FILE * logfile) { msgLevel = _msgLevel; - msgFile = fopen(".player", "a+"); + msgFile = logfile; } #define MSG_MAX 1024 Modified: code/player/trunk/libplayercore/error.h =================================================================== --- code/player/trunk/libplayercore/error.h 2008-10-07 11:42:58 UTC (rev 7085) +++ code/player/trunk/libplayercore/error.h 2008-10-07 20:08:21 UTC (rev 7086) @@ -34,7 +34,7 @@ #endif /// @internal Initialize error logging -void ErrorInit(int _msgLevel); +void ErrorInit(int _msgLevel, FILE * logfile); /// @internal Function for print and logging errors. Do not call this /// function directly; use the macros below. Modified: code/player/trunk/libplayersd/playersd_mdns.c =================================================================== --- code/player/trunk/libplayersd/playersd_mdns.c 2008-10-07 11:42:58 UTC (rev 7085) +++ code/player/trunk/libplayersd/playersd_mdns.c 2008-10-07 20:08:21 UTC (rev 7086) @@ -163,7 +163,7 @@ itable_init(); // Pick a default debug level - ErrorInit(1); + ErrorInit(1,NULL); return(sd); } Modified: code/player/trunk/libplayertcp/bindings/java/main.java =================================================================== --- code/player/trunk/libplayertcp/bindings/java/main.java 2008-10-07 11:42:58 UTC (rev 7085) +++ code/player/trunk/libplayertcp/bindings/java/main.java 2008-10-07 20:08:21 UTC (rev 7086) @@ -58,7 +58,7 @@ // Initialization stuff playercore_java.player_register_drivers(); - playercore_java.ErrorInit(9); + playercore_java.ErrorInit(9,NULL); playertcp_java.playerxdr_ftable_init(); // Convert "localhost" to a 32-bit address. It will be used to Modified: code/player/trunk/libplayertcp/playertcp.cc =================================================================== --- code/player/trunk/libplayertcp/playertcp.cc 2008-10-07 11:42:58 UTC (rev 7085) +++ code/player/trunk/libplayertcp/playertcp.cc 2008-10-07 20:08:21 UTC (rev 7086) @@ -114,7 +114,7 @@ PlayerTCP::InitGlobals(void) { player_globals_init(); - ErrorInit(1); + ErrorInit(1,NULL); playerxdr_ftable_init(); } Modified: code/player/trunk/server/drivers/mixed/wbr/914/wbr914.cc =================================================================== --- code/player/trunk/server/drivers/mixed/wbr/914/wbr914.cc 2008-10-07 11:42:58 UTC (rev 7085) +++ code/player/trunk/server/drivers/mixed/wbr/914/wbr914.cc 2008-10-07 20:08:21 UTC (rev 7086) @@ -157,7 +157,7 @@ // Baud rate _baud = 416666; - ErrorInit( 9 ); + ErrorInit( 9, NULL ); // zero ids, so that we'll know later which interfaces were // requested Modified: code/player/trunk/server/server.cc =================================================================== --- code/player/trunk/server/server.cc 2008-10-07 11:42:58 UTC (rev 7085) +++ code/player/trunk/server/server.cc 2008-10-07 20:08:21 UTC (rev 7086) @@ -62,6 +62,7 @@ - -p \<port\> : Establish the default TCP port, which will be assigned to any devices in the configuration file without an explicit port assignment. Default: 6665. +- -l <logfile>: File to log messages to (default stdout only) - \<cfgfile\> : The configuration file to read. @section Example @@ -110,7 +111,7 @@ void PrintCopyrightMsg(); void PrintUsage(); int ParseArgs(int* port, int* debuglevel, - char** cfgfilename, int* gz_serverid, + char** cfgfilename, int* gz_serverid, char** logfilename, int argc, char** argv); void Quit(int signum); void Cleanup(); @@ -133,6 +134,7 @@ int* new_ports; int num_ports; char* cfgfilename; + char * logfileName = NULL; if(signal(SIGINT, Quit) == SIG_ERR) { @@ -158,13 +160,16 @@ assert(pudp); PrintVersion(); - if(ParseArgs(&port, &debuglevel, &cfgfilename, &gz_serverid, argc, argv) < 0) + if(ParseArgs(&port, &debuglevel, &cfgfilename, &gz_serverid, &logfileName, argc, argv) < 0) { PrintUsage(); exit(-1); } - ErrorInit(debuglevel); + FILE* logfile = NULL; + if (logfileName) + logfile = fopen(logfileName,"a"); + ErrorInit(debuglevel,logfile); PrintCopyrightMsg(); @@ -399,7 +404,7 @@ int -ParseArgs(int* port, int* debuglevel, char** cfgfilename, int* gz_serverid, +ParseArgs(int* port, int* debuglevel, char** cfgfilename, int* gz_serverid, char **logfilename, int argc, char** argv) { int ch; @@ -416,6 +421,9 @@ case 'd': *debuglevel = atoi(optarg); break; + case 'l': + *logfilename = optarg; + break; case 'p': *port = atoi(optarg); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit