(start-log (self <system-handle>) dir fileName) (make-log-entry (self <system-handle>) value) (end-log (self <system-handle>)) (save-log (self <system-handle>)) (rotate-log (self <system-handle>))If the value of dir above is
#f
, then the function uses the default log directory specified by the variable *log-directory*.3.83.9
The file associated with a log will have the full path name dir/fileName-volxxx.log where xxx denotes a volume associated with the log. A new volume is created whenever end-log, save-log or rotate-log are called.
When (make-entry self value) is called, a line in the log is created with the following format:
timestamp entry-number (current-time (timer self)) (name self) valuewhere timestamp is a floating point value representing time in seconds (to a precision of microseconds) since Jan 1 1970, and entry-number is the number of the entry being made (the first entry in any volume is sequence 0).
While is not required, it is strongly suggested to use an association list as the parameter value
in make-log-entry. See the examples below.
The code below show how to log data from Vulcan.
(define *logger* (start (make <system-handle>))) (define (log-data directory fileName max-time sleep-time) ;;; max-time = duration (in seconds) ;;; sleep-time = interval (in seconds) (let ((mt (start-<timer>))) (mreset-origin my-robot 0 0 0) (start-log *logger* directory fileName) (reset mt) (let loop () (make-log-entry *logger* `((location . ,(current-position my-robot)) (points . ,(get-current-rangefinder-points my-robot)) )) (when (not (> (current-time mt) max-time)) (thread-sleep sleep-time) (loop))) (save-log *logger*) ) )end of example