[log4cl-cvs] CVS update: log4cl/appender.lisp

Marco Baringer mbaringer at common-lisp.net
Tue Mar 2 18:37:45 UTC 2004


Update of /project/log4cl/cvsroot/log4cl
In directory common-lisp.net:/tmp/cvs-serv21500

Modified Files:
	appender.lisp 
Log Message:
Create a generic stream-appender, console-appender is a sub class of this.

Date: Tue Mar  2 13:37:45 2004
Author: mbaringer

Index: log4cl/appender.lisp
diff -u log4cl/appender.lisp:1.3 log4cl/appender.lisp:1.4
--- log4cl/appender.lisp:1.3	Mon Mar  1 13:35:10 2004
+++ log4cl/appender.lisp	Tue Mar  2 13:37:45 2004
@@ -39,17 +39,20 @@
   (:documentation "Log a message with the appropriate level"))
 
 ;; ------------------------------
-;; Appender to log to the console
+;; Appender to a stream
 ;; ------------------------------
 
-(defclass console-appender (appender)
-  ()
-  (:documentation "Console appender, is an appender which log message
-to the default exit"))
+(defclass stream-appender (appender)
+  ((log-stream :initarg :log-stream :accessor stream-appender-log-stream)))
 
-(defmethod log-msg ((appender console-appender) name level message)
-  "Log a message to the standard output"
-  (format t " ~A ~%" (format-log-message (appender-layout appender) name level message)))
+(defmethod log-msg ((appender stream-appender) name level message)
+  (format (stream-appender-log-stream appender)
+          " ~A ~%"
+          (format-log-message (appender-layout appender) name level message)))
+
+(defclass console-appender (stream-appender)
+  ((log-stream :initform *standard-output*))
+  (:documentation "Console appender, is an appender which log message to the default exit"))
 
 ;; ----------------------------
 ;; Appender to log into a file





More information about the Log4cl-cvs mailing list