added logging to repository service and repository service factory

This commit is contained in:
Sebastian Sdorra
2012-06-16 12:22:51 +02:00
parent be877b1d16
commit 6b1a00bffc
2 changed files with 59 additions and 0 deletions

View File

@@ -35,6 +35,9 @@ package sonia.scm.repository.api;
//~--- non-JDK imports --------------------------------------------------------
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.cache.CacheManager;
import sonia.scm.repository.PreProcessorUtil;
import sonia.scm.repository.Repository;
@@ -58,6 +61,14 @@ import sonia.scm.repository.spi.RepositoryServiceProvider;
public final class RepositoryService
{
/**
* the logger for RepositoryService
*/
private static final Logger logger =
LoggerFactory.getLogger(RepositoryService.class);
//~--- constructors ---------------------------------------------------------
/**
* Constructs a new {@link RepositoryService}. This constructor should only
* be called from the {@link RepositoryServiceFactory}.
@@ -88,6 +99,12 @@ public final class RepositoryService
*/
public BlameCommandBuilder getBlameCommand()
{
if (logger.isDebugEnabled())
{
logger.debug("create blame command for repository {}",
repository.getName());
}
return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(),
repository);
}
@@ -101,6 +118,12 @@ public final class RepositoryService
*/
public BrowseCommandBuilder getBrowseCommand()
{
if (logger.isDebugEnabled())
{
logger.debug("create browse command for repository {}",
repository.getName());
}
return new BrowseCommandBuilder(cacheManager, provider.getBrowseCommand(),
repository, preProcessorUtil);
}
@@ -114,6 +137,12 @@ public final class RepositoryService
*/
public CatCommandBuilder getCatCommand()
{
if (logger.isDebugEnabled())
{
logger.debug("create cat command for repository {}",
repository.getName());
}
return new CatCommandBuilder(provider.getCatCommand());
}
@@ -127,6 +156,12 @@ public final class RepositoryService
*/
public DiffCommandBuilder getDiffCommand()
{
if (logger.isDebugEnabled())
{
logger.debug("create diff command for repository {}",
repository.getName());
}
return new DiffCommandBuilder(provider.getDiffCommand());
}
@@ -139,6 +174,12 @@ public final class RepositoryService
*/
public LogCommandBuilder getLogCommand()
{
if (logger.isDebugEnabled())
{
logger.debug("create log command for repository {}",
repository.getName());
}
return new LogCommandBuilder(cacheManager, provider.getLogCommand(),
repository, preProcessorUtil);
}

View File

@@ -41,6 +41,9 @@ import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.cache.CacheManager;
import sonia.scm.repository.PermissionType;
import sonia.scm.repository.PermissionUtil;
@@ -90,6 +93,14 @@ import java.util.Set;
public final class RepositoryServiceFactory
{
/**
* the logger for RepositoryServiceFactory
*/
private static final Logger logger =
LoggerFactory.getLogger(RepositoryServiceFactory.class);
//~--- constructors ---------------------------------------------------------
/**
* Constructs a new {@link RepositoryServiceFactory}. This constructor
* should not be called manually, it should only be used by the injection
@@ -223,6 +234,13 @@ public final class RepositoryServiceFactory
if (provider != null)
{
if (logger.isDebugEnabled())
{
logger.debug(
"create new repository service for repository {} of type {}",
repository.getName(), repository.getType());
}
service = new RepositoryService(cacheManager, provider, repository,
preProcessorUtil);