org.javasimon.callback.logging
Class LogTemplates

java.lang.Object
  extended by org.javasimon.callback.logging.LogTemplates

public class LogTemplates
extends Object

Factory of LogTemplates. Produces various implementations

Author:
gquintana

Constructor Summary
LogTemplates()
           
 
Method Summary
static
<C> DisabledLogTemplate<C>
disabled()
          Produces a disabled log template wich never log anything
static
<C> PeriodicLogTemplate<C>
everyNMilliseconds(LogTemplate<C> delegateLogger, long period)
          Produces a log template which logs something at most every N milliseconds
static
<C> PeriodicLogTemplate<C>
everyNSeconds(LogTemplate<C> delegateLogger, long period)
          Produces a log template which logs something at most every N secoonds
static
<C> CounterLogTemplate<C>
everyNSplits(LogTemplate<C> delegateLogger, int period)
          Produces a log template which logs something every N split
static
<C> JULLogTemplate<C>
toJUL(String loggerName, Level level)
          Produces a concrete log template which logs messages into a Java Util Logging Logger.
static
<C> SLF4JLogTemplate<C>
toSLF4J(String loggerName, String levelName)
          Produces a concrete log template which logs messages into a SLF4J Logger.
static
<C> SLF4JLogTemplate<C>
toSLF4J(String loggerName, String levelName, String markerName)
          Produces a concrete log template which logs messages into a SLF4J Logger.
static SplitThresholdLogTemplate whenSplitLongerThanMilliseconds(LogTemplate<Split> delegateLogger, long threshold)
          Produces a log template which logs something when stopwatch split is longer than threshold.
static SplitThresholdLogTemplate whenSplitLongerThanNanoseconds(LogTemplate<Split> delegateLogger, long threshold)
          Produces a log template which logs something when stopwatch split is longer than threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogTemplates

public LogTemplates()
Method Detail

disabled

public static <C> DisabledLogTemplate<C> disabled()
Produces a disabled log template wich never log anything


everyNSplits

public static <C> CounterLogTemplate<C> everyNSplits(LogTemplate<C> delegateLogger,
                                                     int period)
Produces a log template which logs something every N split

Parameters:
delegateLogger - Concrete log template
period - N value, period
Returns:
Logger

everyNMilliseconds

public static <C> PeriodicLogTemplate<C> everyNMilliseconds(LogTemplate<C> delegateLogger,
                                                            long period)
Produces a log template which logs something at most every N milliseconds

Parameters:
delegateLogger - Concrete log template
period - N value in milliseconds, maximum period
Returns:
Logger

everyNSeconds

public static <C> PeriodicLogTemplate<C> everyNSeconds(LogTemplate<C> delegateLogger,
                                                       long period)
Produces a log template which logs something at most every N secoonds

Parameters:
delegateLogger - Concrete log template
period - N value in seconds, maximum period
Returns:
Logger

toSLF4J

public static <C> SLF4JLogTemplate<C> toSLF4J(String loggerName,
                                              String levelName,
                                              String markerName)
Produces a concrete log template which logs messages into a SLF4J Logger.

Parameters:
loggerName - Logger name
levelName - Level name (info, debug, warn, etc.)
markerName - Marker name
Returns:
Logger

toSLF4J

public static <C> SLF4JLogTemplate<C> toSLF4J(String loggerName,
                                              String levelName)
Produces a concrete log template which logs messages into a SLF4J Logger.

Parameters:
loggerName - Logger name
levelName - Level name (info, debug, warn, etc.)
Returns:
Logger

toJUL

public static <C> JULLogTemplate<C> toJUL(String loggerName,
                                          Level level)
Produces a concrete log template which logs messages into a Java Util Logging Logger.

Parameters:
loggerName - Logger name
level - Level (warn, fine, finer, etc.)
Returns:
Logger

whenSplitLongerThanNanoseconds

public static SplitThresholdLogTemplate whenSplitLongerThanNanoseconds(LogTemplate<Split> delegateLogger,
                                                                       long threshold)
Produces a log template which logs something when stopwatch split is longer than threshold.

Parameters:
delegateLogger - Concrete log template
threshold - Threshold (in nanoseconds), above which logging is enabled
Returns:
Logger

whenSplitLongerThanMilliseconds

public static SplitThresholdLogTemplate whenSplitLongerThanMilliseconds(LogTemplate<Split> delegateLogger,
                                                                        long threshold)
Produces a log template which logs something when stopwatch split is longer than threshold.

Parameters:
delegateLogger - Concrete log template
threshold - Threshold (in milliseconds), above which logging is enabled
Returns:
Logger


Copyright © 2013. All Rights Reserved.