Update of /cvsroot/playerstage/code/player/server/drivers/shell
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21800/server/drivers/shell
Modified Files:
Tag: release-2-0-patches
writelog.cc
Log Message:
applied patch 1771456
Index: writelog.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/shell/writelog.cc,v
retrieving revision 1.71.2.2
retrieving revision 1.71.2.3
diff -C2 -d -r1.71.2.2 -r1.71.2.3
*** writelog.cc 14 Mar 2007 16:47:30 -0000 1.71.2.2
--- writelog.cc 18 Oct 2007 21:14:11 -0000 1.71.2.3
***************
*** 96,103 ****
@par Configuration file options
!
- filename (string)
! - Default: "writelog_YYYY_MM_DD_HH_MM.log", where YYYY is the year,
! MM is the month, etc.
- Name of logfile.
- autorecord (integer)
--- 96,112 ----
@par Configuration file options
! - log_directory (string)
! - Default: Directory player is run from.
! - Name of the directory to store the log file in. Relative paths are
! taken from the directory player is run from. Absolute paths work
! as expected.
! - basename (string)
! - Default: writelog, produces the logfile: "writelog_YYYY_MM_DD_HH_MM.log",
! where YYYY is the year, MM is the month, etc.
! - Base name of the logfile to attach the time stamp to. If specified the
logfile
! will be "(basename)_YYYY_MM_DD_HH_MM.log".
- filename (string)
! - Default: "(basename)_YYYY_MM_DD_HH_MM.log", where YYYY is the year,
! MM is the month, etc. If this parameter is specified it will NOT be time
stamped.
- Name of logfile.
- autorecord (integer)
***************
*** 113,121 ****
@verbatim
! # Log data from laser:0 position2d:0 to "mydata.log"
driver
(
name "writelog"
! filename "mydata.log"
requires ["laser:0" "position2d:0"]
provides ["log:0"]
--- 122,131 ----
@verbatim
! # Log data from laser:0 position2d:0 to
"/home/data/logs/mydata_YYYY_MM_DD_HH_MM.log"
driver
(
name "writelog"
! log_directory "/home/user/logs"
! basename "mydata"
requires ["laser:0" "position2d:0"]
provides ["log:0"]
***************
*** 247,252 ****
// File to write data to
- private: char default_basename[1024];
- private: char default_filename[1024];
private: char filename[1024];
private: FILE *file;
--- 257,260 ----
***************
*** 299,317 ****
struct tm *ts;
this->file = NULL;
! // Construct default filename from date and time. Note that we use
// the system time, *not* the Player time. I think that this is the
// correct semantics for working with simulators.
time(&t);
ts = localtime(&t);
! strftime(this->default_basename, sizeof(this->default_filename),
! "writelog_%Y_%m_%d_%H_%M", ts);
! snprintf(this->default_filename, sizeof(this->default_filename), "%s.log",
! this->default_basename);
// Let user override default filename
! strcpy(this->filename,
! cf->ReadString(section, "filename", this->default_filename));
// Default enabled?
--- 307,343 ----
struct tm *ts;
+ char time_stamp[32];
+ char basename[1024];
+ char default_filename[1024];
+ char complete_filename[1024];
+ char log_directory[1024];
+
this->file = NULL;
! // Construct timestamp from date and time. Note that we use
// the system time, *not* the Player time. I think that this is the
// correct semantics for working with simulators.
time(&t);
ts = localtime(&t);
! strftime(time_stamp, sizeof(time_stamp),
! "_%Y_%m_%d_%H_%M", ts);
!
! // Let user override default basename
! strcpy(basename, cf->ReadString(section, "basename", "writelog"));
!
! // Attach the time stamp
! snprintf(default_filename, sizeof(default_filename), "%s%s.log",
! basename, time_stamp);
// Let user override default filename
! strcpy(complete_filename,
! cf->ReadString(section, "filename", default_filename));
!
! // Let user override log file directory
! strcpy(log_directory, cf->ReadString(section, "log_directory", "."));
!
! // Prepend the directory
! snprintf(this->filename, sizeof(this->filename), "%s/%s",
! log_directory, complete_filename);
// Default enabled?
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit