mirror of
https://github.com/stumpwm/stumpwm.git
synced 2026-09-10 07:26:20 -04:00
move (rotate|open|close)-log from debug to primitives
These functions need to be compiled after the *data-dir* is defined. An easy option is to move them to primitives.lisp where other data-dir related things are defined.
This commit is contained in:
parent
2377e38a26
commit
54a901abd3
17
debug.lisp
17
debug.lisp
|
|
@ -68,20 +68,3 @@ do:
|
|||
*standard-output* *redirect-stream*
|
||||
*trace-output* *redirect-stream*
|
||||
*debug-stream* *redirect-stream*))
|
||||
|
||||
(defun rotate-log ()
|
||||
(let ((log-filename (merge-pathnames "stumpwm.log" *data-dir*))
|
||||
(bkp-log-filename (merge-pathnames "stumpwm.log.1" *data-dir*)))
|
||||
(when (probe-file log-filename)
|
||||
(rename-file log-filename bkp-log-filename))))
|
||||
|
||||
(defun open-log ()
|
||||
(rotate-log)
|
||||
(let ((log-filename (merge-pathnames "stumpwm.log" *data-dir*)))
|
||||
(setf *debug-stream* (open log-filename :direction :output
|
||||
:if-exists :supersede
|
||||
:if-does-not-exist :create))))
|
||||
(defun close-log ()
|
||||
(when (boundp '*debug-stream*)
|
||||
(close *debug-stream*)
|
||||
(makunbound '*debug-stream*)))
|
||||
|
|
|
|||
|
|
@ -1566,7 +1566,24 @@ of :error."
|
|||
(ensure-data-dir)
|
||||
(with-open-file (,s ,(merge-pathnames file *data-dir*)
|
||||
,@keys)
|
||||
,@body)))
|
||||
,@body)))
|
||||
|
||||
(defun rotate-log ()
|
||||
(let ((log-filename (merge-pathnames "stumpwm.log" *data-dir*))
|
||||
(bkp-log-filename (merge-pathnames "stumpwm.log.1" *data-dir*)))
|
||||
(when (probe-file log-filename)
|
||||
(rename-file log-filename bkp-log-filename))))
|
||||
|
||||
(defun open-log ()
|
||||
(rotate-log)
|
||||
(let ((log-filename (merge-pathnames "stumpwm.log" *data-dir*)))
|
||||
(setf *debug-stream* (open log-filename :direction :output
|
||||
:if-exists :supersede
|
||||
:if-does-not-exist :create))))
|
||||
(defun close-log ()
|
||||
(when (boundp '*debug-stream*)
|
||||
(close *debug-stream*)
|
||||
(makunbound '*debug-stream*)))
|
||||
|
||||
(defmacro move-to-head (list elt)
|
||||
"Move the specified element in in LIST to the head of the list."
|
||||
|
|
|
|||
Loading…
Reference in a new issue