public class Core extends AbstractService implements SoneProvider, PostProvider, PostReplyProvider {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Core");
+ private static final Logger logger = getLogger(Core.class.getName());
/** The start time. */
private final long startupTime = System.currentTimeMillis();
public class FreenetInterface {
/** The logger. */
- private static final Logger logger = getLogger("Sone.FreenetInterface");
+ private static final Logger logger = getLogger(FreenetInterface.class.getName());
/** The event bus. */
private final EventBus eventBus;
public class ImageInserter {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Image.Inserter");
+ private static final Logger logger = getLogger(ImageInserter.class.getName());
/** The freenet interface. */
private final FreenetInterface freenetInterface;
public class SoneDownloaderImpl extends AbstractService implements SoneDownloader {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Downloader");
+ private static final Logger logger = getLogger(SoneDownloaderImpl.class.getName());
/** The maximum protocol version. */
private static final int MAX_PROTOCOL_VERSION = 0;
public class SoneInserter extends AbstractService {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Inserter");
+ private static final Logger logger = getLogger(SoneInserter.class.getName());
/** The insertion delay (in seconds). */
private static final AtomicInteger insertionDelay = new AtomicInteger(60);
*/
public class SoneParser {
- private static final Logger logger = getLogger("Sone.Parser");
+ private static final Logger logger = getLogger(SoneParser.class.getName());
private static final int MAX_PROTOCOL_VERSION = 0;
private final Core core;
public class SoneUri {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Data");
+ private static final Logger logger = getLogger(SoneUri.class.getName());
/**
* Generate a Sone URI from the given URI.
public class UpdateChecker {
/** The logger. */
- private static final Logger logger = getLogger("Sone.UpdateChecker");
+ private static final Logger logger = getLogger(UpdateChecker.class.getName());
/** The event bus. */
private final EventBus eventBus;
public class WebOfTrustUpdaterImpl extends AbstractService implements WebOfTrustUpdater {
/** The logger. */
- private static final Logger logger = getLogger("Sone.WoT.Updater");
+ private static final Logger logger = getLogger(WebOfTrustUpdaterImpl.class.getName());
/** Stop job. */
@SuppressWarnings("synthetic-access")
public class SoneImpl implements Sone {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Data");
+ private static final Logger logger = getLogger(SoneImpl.class.getName());
/** The database. */
private final Database database;
*/
public class ConfigurationLoader {
- private static final Logger logger =
- Logger.getLogger("Sone.Database.Memory.Configuration");
+ private static final Logger logger = Logger.getLogger(ConfigurationLoader.class.getName());
private final Configuration configuration;
public ConfigurationLoader(Configuration configuration) {
}
/** The logger. */
- private static final Logger logger = getLogger("Sone.External.Fcp");
+ private static final Logger logger = getLogger(FcpInterface.class.getName());
/** Whether the FCP interface is currently active. */
private final AtomicBoolean active = new AtomicBoolean();
/** The logger. */
@SuppressWarnings("unused")
- private static final Logger logger = getLogger("Sone.Fred");
+ private static final Logger logger = getLogger(PluginStoreConfigurationBackend.class.getName());
/** The plugin respirator. */
private final PluginRespirator pluginRespirator;
public class IdentityManagerImpl extends AbstractService implements IdentityManager {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Identities");
+ private static final Logger logger = getLogger(IdentityManagerImpl.class.getName());
/** The event bus. */
private final EventBus eventBus;
public class WebOfTrustConnector {
/** The logger. */
- private static final Logger logger = getLogger("Sone.WoT.Connector");
+ private static final Logger logger = getLogger(WebOfTrustConnector.class.getName());
/** The name of the WoT plugin. */
private static final String WOT_PLUGIN_NAME = "plugins.WebOfTrust.WebOfTrust";
import java.util.logging.Logger;
import net.pterodactylus.sone.core.Core;
-import net.pterodactylus.sone.core.FreenetInterface;
-import net.pterodactylus.sone.core.WebOfTrustUpdater;
-import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl;
-import net.pterodactylus.sone.database.Database;
-import net.pterodactylus.sone.database.PostBuilderFactory;
-import net.pterodactylus.sone.database.PostProvider;
-import net.pterodactylus.sone.database.PostReplyBuilderFactory;
-import net.pterodactylus.sone.database.SoneProvider;
-import net.pterodactylus.sone.database.memory.MemoryDatabase;
import net.pterodactylus.sone.fcp.FcpInterface;
import net.pterodactylus.sone.freenet.PluginStoreConfigurationBackend;
-import net.pterodactylus.sone.freenet.plugin.PluginConnector;
import net.pterodactylus.sone.freenet.wot.Context;
-import net.pterodactylus.sone.freenet.wot.IdentityManager;
-import net.pterodactylus.sone.freenet.wot.IdentityManagerImpl;
import net.pterodactylus.sone.freenet.wot.WebOfTrustConnector;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.config.Configuration;
import net.pterodactylus.util.version.Version;
import com.google.common.base.Optional;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
import com.google.common.eventbus.EventBus;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
static {
/* initialize logging. */
- Logger soneLogger = getLogger("Sone");
+ Logger soneLogger = getLogger("net.pterodactylus.sone");
soneLogger.setUseParentHandlers(false);
soneLogger.addHandler(new Handler() {
+ private final LoadingCache<String, Class<?>> classCache = CacheBuilder.newBuilder()
+ .build(new CacheLoader<String, Class<?>>() {
+ @Override
+ public Class<?> load(String key) throws Exception {
+ return Class.forName(key);
+ }
+ });
+
@Override
public void publish(LogRecord logRecord) {
int recordLevel = logRecord.getLevel().intValue();
+ Class<?> loggingClass = classCache.getUnchecked(logRecord.getLoggerName());
if (recordLevel < Level.FINE.intValue()) {
- freenet.support.Logger.debug(logRecord.getLoggerName(), logRecord.getMessage(), logRecord.getThrown());
+ freenet.support.Logger.debug(loggingClass, logRecord.getMessage(), logRecord.getThrown());
} else if (recordLevel < Level.INFO.intValue()) {
- freenet.support.Logger.minor(logRecord.getLoggerName(), logRecord.getMessage(), logRecord.getThrown());
+ freenet.support.Logger.minor(loggingClass, logRecord.getMessage(), logRecord.getThrown());
} else if (recordLevel < Level.WARNING.intValue()) {
- freenet.support.Logger.normal(logRecord.getLoggerName(), logRecord.getMessage(), logRecord.getThrown());
+ freenet.support.Logger.normal(loggingClass, logRecord.getMessage(), logRecord.getThrown());
} else if (recordLevel < Level.SEVERE.intValue()) {
- freenet.support.Logger.warning(logRecord.getLoggerName(), logRecord.getMessage(), logRecord.getThrown());
+ freenet.support.Logger.warning(loggingClass, logRecord.getMessage(), logRecord.getThrown());
} else {
- freenet.support.Logger.error(logRecord.getLoggerName(), logRecord.getMessage(), logRecord.getThrown());
+ freenet.support.Logger.error(loggingClass, logRecord.getMessage(), logRecord.getThrown());
}
}
private static final int LATEST_EDITION = 69;
/** The logger. */
- private static final Logger logger = getLogger("Sone.Plugin");
+ private static final Logger logger = getLogger(SonePlugin.class.getName());
/** The plugin respirator. */
private PluginRespirator pluginRespirator;
public class SoneAccessor extends ReflectionAccessor {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Data");
+ private static final Logger logger = getLogger(SoneAccessor.class.getName());
/** The core. */
private final Core core;
public class SoneTextParser implements Parser<SoneTextParserContext> {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Data.Parser");
+ private static final Logger logger = getLogger(SoneTextParser.class.getName());
/** Pattern to detect whitespace. */
private static final Pattern whitespacePattern = Pattern.compile("[\\u000a\u0020\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u200c\u200d\u202f\u205f\u2060\u2800\u3000]");
public class CreateSonePage extends SoneTemplatePage {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Web.CreateSone");
+ private static final Logger logger = getLogger(CreateSonePage.class.getName());
/**
* Creates a new “create Sone” page.
/** The logger. */
@SuppressWarnings("unused")
- private static final Logger logger = getLogger("Sone.Web.Login");
+ private static final Logger logger = getLogger(LoginPage.class.getName());
/**
* Creates a new login page.
public class SearchPage extends SoneTemplatePage {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Web.Search");
+ private static final Logger logger = getLogger(SearchPage.class.getName());
/** Short-term cache. */
private final LoadingCache<List<Phrase>, Set<Hit<Post>>> hitCache = CacheBuilder.newBuilder().expireAfterWrite(5, TimeUnit.MINUTES).build(new CacheLoader<List<Phrase>, Set<Hit<Post>>>() {
public class UploadImagePage extends SoneTemplatePage {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Web.UploadImage");
+ private static final Logger logger = getLogger(UploadImagePage.class.getName());
/**
* Creates a new “upload image” page.
public class WebInterface {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Web.Main");
+ private static final Logger logger = getLogger(WebInterface.class.getName());
/** The notification manager. */
private final NotificationManager notificationManager = new NotificationManager();
public abstract class JsonPage implements FreenetPage {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Web.Ajax");
+ private static final Logger logger = getLogger(JsonPage.class.getName());
/** The JSON serializer. */
private static final ObjectMapper objectMapper = new ObjectMapper();
public class FreenetTemplatePage implements FreenetPage, LinkEnabledCallback {
/** The logger. */
- private static final Logger logger = getLogger("Sone.Web.Freenet");
+ private static final Logger logger = getLogger(FreenetTemplatePage.class.getName());
/** The path of the page. */
private final String path;