;;; This is logging-tools.lsp ;;; started 13 February 2018 ;;; holding some simple things to log parts of building a project ;;; ;;; First create a file name string ;;; this assume asdf is available for ;;; uiop/filesystem:directory-exists-p (in-package :cl-user) (defun simple-log (project topic system) "Creates a string for a dated pathname to project,topic,system in ~/LOGS" (let* ((project-up (string-upcase project)) (up-system (string-upcase system)) (target-project-directory-string (concatenate 'string "/home/gwbennett/LOGS" "/" project-up)) (date-time (multiple-value-list (get-decoded-time))) (date-date (fourth date-time)) (date-month (fifth date-time)) (date-year (sixth date-time)) (the-time (format nil "~a:~a:~a" (third date-time) (second date-time) (first date-time))) (dates (list "JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC"))) (when (uiop/filesystem:directory-exists-p target-project-directory-string) (return-from simple-log (pathname (concatenate 'string target-project-directory-string "/" project-up (format nil "~a" date-year) "-" (or #+(and :sbcl :linux)(format nil "lsbcl") #+(and :ccl :linux)(format nil "lccl") #+(and :allegro :linux)(format nil "lacl") #+(and :allegro :mswindows)(format nil "wacl")) "-to-" up-system "-" (format nil "~a" date-date) "-" (elt dates (- date-month 1)) "-at-" the-time ".lsp") ) )) (format t "~%Sorry! Directory ~a does not exist" target-project-directory-string) )) ;;; Then the dribble duplication (defmacro my-with-dribble (dribble-file &body body) `(progn (dribble ,dribble-file );:if-exists :supersede) (let ((*error-output* *standard-output*)) ,@body (dribble)))) ;;; Finally the logger ;; with calling sequence (a-l "quail" "quail-make" (quail-make) "window-basics") (defun a-l (project load-file-string load-file system &key (base-name "/home/gwbennett/RESERVE/lc2-Quail/")) (unwind-protect (my-with-dribble (simple-log project load-file-string system) load-file )) )