Package it.unive.lisa.logging
Class IterationLogger
- java.lang.Object
-
- it.unive.lisa.logging.IterationLogger
-
public final class IterationLogger extends java.lang.Object
An utility class that allows automatic logging while iterating over elements of a collection, stream or array.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> java.lang.Iterable<E>
iterate(org.apache.logging.log4j.Logger logger, E[] array, java.lang.String message, java.lang.String objects)
Wraps the given array into anIterable
instance that automatically logs at levelLevel.INFO
while traversing the array.static <E> java.lang.Iterable<E>
iterate(org.apache.logging.log4j.Logger logger, java.lang.Iterable<E> iterable, java.lang.String message, java.lang.String objects)
Wraps the given iterable into anIterable
instance that automatically logs at levelLevel.INFO
while traversing the array.static <E> java.lang.Iterable<E>
iterate(org.apache.logging.log4j.Logger logger, java.util.Collection<E> collection, java.lang.String message, java.lang.String objects)
Wraps the given collection into anIterable
instance that automatically logs at levelLevel.INFO
while traversing the collection.static <E> java.lang.Iterable<E>
iterate(org.apache.logging.log4j.Logger logger, java.util.stream.Stream<E> stream, java.lang.String message, java.lang.String objects)
Wraps the given stream into anIterable
instance that automatically logs at levelLevel.INFO
while traversing a collection created from the stream.static <E> java.lang.Iterable<E>
iterate(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, E[] array, java.lang.String message, java.lang.String objects)
Wraps the given array into anIterable
instance that automatically logs while traversing the array.static <E> java.lang.Iterable<E>
iterate(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.lang.Iterable<E> iterable, java.lang.String message, java.lang.String objects)
Wraps the given iterable into anIterable
instance that automatically logs while traversing the iterable.static <E> java.lang.Iterable<E>
iterate(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.util.Collection<E> collection, java.lang.String message, java.lang.String objects)
Wraps the given collection into anIterable
instance that automatically logs while traversing the collection.static <E> java.lang.Iterable<E>
iterate(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.util.stream.Stream<E> stream, java.lang.String message, java.lang.String objects)
Wraps the given array into anIterable
instance that automatically logs while traversing a collection created from the stream.
-
-
-
Method Detail
-
iterate
public static <E> java.lang.Iterable<E> iterate(org.apache.logging.log4j.Logger logger, E[] array, java.lang.String message, java.lang.String objects)
Wraps the given array into anIterable
instance that automatically logs at levelLevel.INFO
while traversing the array.- Type Parameters:
E
- the type of elements in the array- Parameters:
logger
- the logger to log ontoarray
- the array to be iterated overmessage
- the message to display at each updateobjects
- the objects being counted- Returns:
- an iterable that automatically logs while traversing the array
-
iterate
public static <E> java.lang.Iterable<E> iterate(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, E[] array, java.lang.String message, java.lang.String objects)
Wraps the given array into anIterable
instance that automatically logs while traversing the array.- Type Parameters:
E
- the type of elements in the array- Parameters:
logger
- the logger to log ontolevel
- theLevel
to log toarray
- the array to be iterated overmessage
- the message to display at each updateobjects
- the objects being counted- Returns:
- an iterable that automatically logs while traversing the array
-
iterate
public static <E> java.lang.Iterable<E> iterate(org.apache.logging.log4j.Logger logger, java.util.Collection<E> collection, java.lang.String message, java.lang.String objects)
Wraps the given collection into anIterable
instance that automatically logs at levelLevel.INFO
while traversing the collection.- Type Parameters:
E
- the type of elements in the collection- Parameters:
logger
- the logger to log ontocollection
- the collection to be iterated overmessage
- the message to display at each updateobjects
- the objects being counted- Returns:
- an iterable that automatically logs while traversing the collection
-
iterate
public static <E> java.lang.Iterable<E> iterate(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.util.Collection<E> collection, java.lang.String message, java.lang.String objects)
Wraps the given collection into anIterable
instance that automatically logs while traversing the collection.- Type Parameters:
E
- the type of elements in the collection- Parameters:
logger
- the logger to log ontolevel
- theLevel
to log tocollection
- the collection to be iterated overmessage
- the message to display at each updateobjects
- the objects being counted- Returns:
- an iterable that automatically logs while traversing the collection
-
iterate
public static <E> java.lang.Iterable<E> iterate(org.apache.logging.log4j.Logger logger, java.lang.Iterable<E> iterable, java.lang.String message, java.lang.String objects)
Wraps the given iterable into anIterable
instance that automatically logs at levelLevel.INFO
while traversing the array.- Type Parameters:
E
- the type of elements in the iterable- Parameters:
logger
- the logger to log ontoiterable
- the iterable to be iterated overmessage
- the message to display at each updateobjects
- the objects being counted- Returns:
- an iterable that automatically logs while traversing the iterable
-
iterate
public static <E> java.lang.Iterable<E> iterate(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.lang.Iterable<E> iterable, java.lang.String message, java.lang.String objects)
Wraps the given iterable into anIterable
instance that automatically logs while traversing the iterable.- Type Parameters:
E
- the type of elements in the iterable- Parameters:
logger
- the logger to log ontolevel
- theLevel
to log toiterable
- the iterable to be iterated overmessage
- the message to display at each updateobjects
- the objects being counted- Returns:
- an iterable that automatically logs while traversing the iterable
-
iterate
public static <E> java.lang.Iterable<E> iterate(org.apache.logging.log4j.Logger logger, java.util.stream.Stream<E> stream, java.lang.String message, java.lang.String objects)
Wraps the given stream into anIterable
instance that automatically logs at levelLevel.INFO
while traversing a collection created from the stream.- Type Parameters:
E
- the type of elements in the stream- Parameters:
logger
- the logger to log ontostream
- the stream to be iterated overmessage
- the message to display at each updateobjects
- the objects being counted- Returns:
- an iterable that automatically logs while traversing the collection created from the stream
-
iterate
public static <E> java.lang.Iterable<E> iterate(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.util.stream.Stream<E> stream, java.lang.String message, java.lang.String objects)
Wraps the given array into anIterable
instance that automatically logs while traversing a collection created from the stream.- Type Parameters:
E
- the type of elements in the stream- Parameters:
logger
- the logger to log ontolevel
- theLevel
to log tostream
- the array to be iterated overmessage
- the message to display at each updateobjects
- the objects being counted- Returns:
- an iterable that automatically logs while traversing the collection created from the stream
-
-