All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.core.logging.LogBuffer Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.core.logging;

/**
 * In-memory implementation of {@link ILogOutput}.
 * 

* Stores all log output internally in a {@link StringBuilder}. The logged text * can be returned using {@link #toString()}. * * @author Oliver Richers */ public class LogBuffer implements ILogOutput { private final StringBuilder builder; public LogBuffer() { this.builder = new StringBuilder(); } @Override public synchronized void logLine(String line) { builder.append(line).append("\n"); } /** * Returns all logged text. */ @Override public synchronized String toString() { return builder.toString(); } /** * Clears this buffer by discarding all previously logged text. */ public synchronized void clear() { builder.setLength(0); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy