Refactor persistent logging to bramble-core.

This commit is contained in:
akwizgran
2020-07-04 12:16:55 +01:00
parent ca5c18ece3
commit cda722a8b2
11 changed files with 13 additions and 13 deletions

View File

@@ -0,0 +1,40 @@
package org.briarproject.bramble.api.logging;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.settings.Settings;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.logging.Handler;
@NotNullByDefault
public interface PersistentLogManager {
/**
* The namespace of the (@link Settings) where the log key is stored.
*/
String LOG_SETTINGS_NAMESPACE = "log";
/**
* The {@link Settings} key under which the log key is stored.
*/
String LOG_KEY_KEY = "logKey";
/**
* Creates and returns a persistent log handler that stores its logs in
* the given directory.
* <p>
* This method should only be called once.
*/
Handler createLogHandler(File dir) throws IOException;
/**
* Loads and returns the persistent log entries stored in the given
* directory, or an empty list if no log entries are found.
*
* @param old True if the previous session's log should be loaded, or false
* if the current session's log should be loaded
*/
List<String> getPersistedLog(File dir, boolean old) throws IOException;
}