[logback-dev] svn commit: r928 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read

noreply.ceki at qos.ch noreply.ceki at qos.ch
Fri Nov 17 10:58:01 CET 2006


Author: ceki
Date: Fri Nov 17 10:58:01 2006
New Revision: 928

Added:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read/CyclicBufferAppender.java

Log:
inital version of CyclicBufferAppender

Added: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read/CyclicBufferAppender.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read/CyclicBufferAppender.java	Fri Nov 17 10:58:01 2006
@@ -0,0 +1,52 @@
+package ch.qos.logback.core.read;
+
+import ch.qos.logback.core.AppenderBase;
+import ch.qos.logback.core.Layout;
+import ch.qos.logback.core.helpers.CyclicBuffer;
+
+public class CyclicBufferAppender extends AppenderBase {
+
+  
+  CyclicBuffer cb;
+  int maxSize = 512;
+  
+  public void start() {
+    
+    cb = new CyclicBuffer(maxSize);
+    super.start();
+  }
+  
+  
+  @Override
+  protected void append(Object eventObject) {
+    if(!isStarted()) {
+      return;
+    }
+    cb.add(eventObject);
+  }
+
+  int getLength() {
+    return cb.length();
+  }
+
+  Object get(int i) {
+    return cb.get(i);
+  }
+  
+  
+  public Layout getLayout() {
+    return null;
+  }
+
+  public void setLayout(Layout layout) {
+  }
+
+  public int getMaxSize() {
+    return maxSize;
+  }
+
+  public void setMaxSize(int maxSize) {
+    this.maxSize = maxSize;
+  }
+
+}



More information about the logback-dev mailing list