public final class SpiLoggerFactory extends Object
AbstractLogger
.
In the most simple case
RepositoryService loggingService = SpiLoggerFactory.create(service);creates a log wrapper for
service
which logs all calls to its methods
if logging at the debug level is enabled. If logging is not enabled, no log wrapper
is created at all and service
itself is returned. There is thus virtually
no overhead from disabled loggers. Loggers are enabled and disabled via the
configuration mechanism of the logging framework which is in place.
There are log wrappers for the following SPI entities:
RepositoryService loggingService = SpiLoggerFactory.create(service, logWriterProvider);allows specification of a
LogWriterProvider
. A LogWriterProvider provides the
LogWriter
s for the individual SPI entities. If the LogWriter does not provide a
LogWriter for a certain SPI entity no log wrapper is created for that entity. In the case
of Slf4jLogWriterProvider
, a LogWriter is only provided if the logger of the
implementation class of the respective SPI entity is names after the class and has debug
level enabled.Modifier and Type | Method and Description |
---|---|
static Batch |
create(Batch batch,
LogWriterProvider logWriterProvider)
Returns a log wrapper for the given
batch which logs a calls to its
methods if logWriterProvider returns a LogWriter instance for
batch . |
static IdFactory |
create(IdFactory idFactory,
LogWriterProvider logWriterProvider)
Returns a log wrapper for the given
idFactory which logs a calls to its
methods if logWriterProvider returns a LogWriter instance for
idFactory . |
static NameFactory |
create(NameFactory nameFactory,
LogWriterProvider logWriterProvider)
Returns a log wrapper for the given
nameFactory which logs a calls to its
methods if logWriterProvider returns a LogWriter instance for
nameFactory . |
static PathFactory |
create(PathFactory pathFactory,
LogWriterProvider logWriterProvider)
Returns a log wrapper for the given
pathFactory which logs a calls to its
methods if logWriterProvider returns a LogWriter instance for
pathFactory . |
static QValueFactory |
create(QValueFactory qValueFactory,
LogWriterProvider logWriterProvider)
Returns a log wrapper for the given
qValueFactory which logs a calls to its
methods if logWriterProvider returns a LogWriter instance for
qValueFactory . |
static RepositoryService |
create(RepositoryService service)
Shortcut for
|
static RepositoryService |
create(RepositoryService service,
LogWriterProvider logWriterProvider)
Returns a log wrapper for the given
service which logs a calls to its
methods if logWriterProvider returns a LogWriter instance for
service . |
static SessionInfo |
create(SessionInfo sessionInfo,
LogWriterProvider logWriterProvider)
Returns a log wrapper for the given
sessionInfo which logs a calls to its
methods if logWriterProvider returns a LogWriter instance for
sessionInfo . |
public static RepositoryService create(RepositoryService service)
create(service, new Slf4jLogWriterProvider());
service
- create(RepositoryService, LogWriterProvider)
public static RepositoryService create(RepositoryService service, LogWriterProvider logWriterProvider)
service
which logs a calls to its
methods if logWriterProvider
returns a LogWriter
instance for
service
. Otherwise returns service
.service
- logWriterProvider
- IllegalArgumentException
- if either argument is null
public static NameFactory create(NameFactory nameFactory, LogWriterProvider logWriterProvider)
nameFactory
which logs a calls to its
methods if logWriterProvider
returns a LogWriter
instance for
nameFactory
. Otherwise returns nameFactory
.nameFactory
- logWriterProvider
- IllegalArgumentException
- if either argument is null
public static PathFactory create(PathFactory pathFactory, LogWriterProvider logWriterProvider)
pathFactory
which logs a calls to its
methods if logWriterProvider
returns a LogWriter
instance for
pathFactory
. Otherwise returns pathFactory
.pathFactory
- logWriterProvider
- IllegalArgumentException
- if either argument is null
public static IdFactory create(IdFactory idFactory, LogWriterProvider logWriterProvider)
idFactory
which logs a calls to its
methods if logWriterProvider
returns a LogWriter
instance for
idFactory
. Otherwise returns idFactory
.idFactory
- logWriterProvider
- IllegalArgumentException
- if either argument is null
public static QValueFactory create(QValueFactory qValueFactory, LogWriterProvider logWriterProvider)
qValueFactory
which logs a calls to its
methods if logWriterProvider
returns a LogWriter
instance for
qValueFactory
. Otherwise returns qValueFactory
.qValueFactory
- logWriterProvider
- IllegalArgumentException
- if either argument is null
public static SessionInfo create(SessionInfo sessionInfo, LogWriterProvider logWriterProvider)
sessionInfo
which logs a calls to its
methods if logWriterProvider
returns a LogWriter
instance for
sessionInfo
. Otherwise returns sessionInfo
.sessionInfo
- logWriterProvider
- IllegalArgumentException
- if either argument is null
public static Batch create(Batch batch, LogWriterProvider logWriterProvider)
batch
which logs a calls to its
methods if logWriterProvider
returns a LogWriter
instance for
batch
. Otherwise returns batch
.batch
- logWriterProvider
- IllegalArgumentException
- if either argument is null
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.