Package org.refcodes.logger
Class LoggerUtility
- java.lang.Object
-
- org.refcodes.logger.LoggerUtility
-
public final class LoggerUtility extends java.lang.Object
The Class LoggerUtility.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <L extends TrimLogger<T>,T>
voidclearLogs(java.util.Collection<L> aLoggers)
Functionality to address multipleTrimLogger
instances to clear the providedTrimLogger
instances (multi-threaded).static <L extends TrimLogger<T>,T>
voiddeleteLogs(org.refcodes.criteria.Criteria aCriteria, java.util.Collection<L> aLoggers)
Functionality to query multipleTrimLogger
instances with the same query to delete log lines from the providedTrimLogger
instances (multi-threaded).static <L extends QueryLogger<T>,T>
org.refcodes.tabular.Records<T>findLogs(org.refcodes.criteria.Criteria aCriteria, org.refcodes.tabular.Header<T> aHeader, int aLimit, java.util.Collection<L> aLoggers, org.refcodes.controlflow.InvocationStrategy aRecordServeStrategy)
Functionality to query multipleQueryLogger
instances with the same query and returning a single compositeRecords
instance containing allRecord
instances returned by the queriedQueryLogger
instances (multi-threaded).static java.lang.String
getSchemaName(java.lang.String aSchemaBody, int aIndex)
Required to create a schema name for aLogger
being part of a compositeLogger
(or its sub-types) and which is being created by aLoggerFactory
.static java.lang.String
getSchemaName(java.lang.String aSchemaPrefix, java.lang.String aSchemaSuffix)
Required to create a schema name for aLogger
being part of a partedLogger
(or its sub-types) and which is being created by aLoggerFactory
.
-
-
-
Method Detail
-
getSchemaName
public static java.lang.String getSchemaName(java.lang.String aSchemaBody, int aIndex)
Required to create a schema name for aLogger
being part of a compositeLogger
(or its sub-types) and which is being created by aLoggerFactory
.- Parameters:
aSchemaBody
- The body part of the schema name.aIndex
- The index number of the encapsulatedLogger
in question.- Returns:
- The schema name created in a uniform way.
-
getSchemaName
public static java.lang.String getSchemaName(java.lang.String aSchemaPrefix, java.lang.String aSchemaSuffix)
Required to create a schema name for aLogger
being part of a partedLogger
(or its sub-types) and which is being created by aLoggerFactory
.- Parameters:
aSchemaPrefix
- The prefix part of the schema name.aSchemaSuffix
- The suffix part of the schema name.- Returns:
- The schema name created in a uniform way.
-
findLogs
public static <L extends QueryLogger<T>,T> org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria, org.refcodes.tabular.Header<T> aHeader, int aLimit, java.util.Collection<L> aLoggers, org.refcodes.controlflow.InvocationStrategy aRecordServeStrategy)
Functionality to query multipleQueryLogger
instances with the same query and returning a single compositeRecords
instance containing allRecord
instances returned by the queriedQueryLogger
instances (multi-threaded). This functionality is in common for both composite as well as partedQueryLogger
(or its sub-classes) instances.- Type Parameters:
L
- TheLogger
type to be used.T
- The type of theRecord
instances managed by theLogger
.- Parameters:
aCriteria
- The query for querying the providesQueryLogger
(or sub-classes).aHeader
- TheHeader
specifying theHeader
to be contained in the result.aLimit
- The maximum number of elements to be returned by each individual logger. TODO: To avoid a quick and dirty solution for this parameter to specify the number of elements in the result, some strategy is to be applied to querying the encapsulatedQueryLogger
instances, just dividing the limit by the number of encapsulatedQueryLogger
instances will often enough result in too few elements in the result. A memory wasting approach would be to pass the limit to theCompositeRecords
, which stops serving elements when the limit is reached :-(aLoggers
- TheQueryLogger
instances (or its sub-types) which are to be queried.aRecordServeStrategy
- The strategy with which to serve theRecord
instances in the returnedRecords
instance, meaning which encapsulatedQueryLogger
's result is to be served next upon theIterator.next()
invocation. TheInvocationStrategy.ROUND_ROBIN
is proposed as of timeouts and "forgotten" results in case one of theQueryLogger
's result is fetched too late (this depends on how long the underlying physical data sink provides for the result).- Returns:
- A
Records
instance containing all the foundRecord
instances.
-
deleteLogs
public static <L extends TrimLogger<T>,T> void deleteLogs(org.refcodes.criteria.Criteria aCriteria, java.util.Collection<L> aLoggers)
Functionality to query multipleTrimLogger
instances with the same query to delete log lines from the providedTrimLogger
instances (multi-threaded).- Type Parameters:
L
- TheLogger
type to be used.T
- The type of theRecord
instances managed by theLogger
.- Parameters:
aCriteria
- TheCriteria
to be used when querying theTrimLogger
instances.aLoggers
- TheTrimLogger
instances (or its sub-types) which are to be queried.
-
clearLogs
public static <L extends TrimLogger<T>,T> void clearLogs(java.util.Collection<L> aLoggers)
Functionality to address multipleTrimLogger
instances to clear the providedTrimLogger
instances (multi-threaded).- Type Parameters:
L
- TheLogger
type to be used.T
- The type of theRecord
instances managed by theLogger
.- Parameters:
aLoggers
- TheTrimLogger
instances (or its sub-types) which are to be used.
-
-