org.javasimon.utils
Class SLF4JLoggingCallback

java.lang.Object
  extended by org.javasimon.callback.CallbackSkeleton
      extended by org.javasimon.utils.SLF4JLoggingCallback
All Implemented Interfaces:
Callback

public class SLF4JLoggingCallback
extends CallbackSkeleton

LoggingCallback logs events via SLF4J logging.

Since:
3.0
Author:
Richard "Virgo" Richter, nigel.thomas@york.ac.uk

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.javasimon.callback.Callback
Callback.Event
 
Field Summary
private  org.slf4j.Logger logger
           
private  org.slf4j.Marker marker
           
 
Constructor Summary
SLF4JLoggingCallback()
           
 
Method Summary
 org.slf4j.Logger getLogger()
          Returns logger used to log messages.
 org.slf4j.Marker getMarker()
          Returns the specified log marker for messages.
 void onManagerMessage(String message)
          Logs the message on a specified log marker.
 void onManagerWarning(String warning, Exception cause)
          Logs the warning on a specified log marker.
 void onStopwatchStart(Split split)
          Logs Simon start on a sprecified log marker.
 void onStopwatchStop(Split split, StopwatchSample sample)
          Logs Simon stop on a specified log marker.
 void setLogger(org.slf4j.Logger logger)
          Sets the logger that will be used to log messages.
 void setMarker(org.slf4j.Marker marker)
          Sets the marker that will be used to log messages.
 void setMarker(String marker)
          Sets the marker via marker name - used by the configure facility to configure the callback.
 
Methods inherited from class org.javasimon.callback.CallbackSkeleton
cleanup, initialize, onCounterDecrease, onCounterIncrease, onCounterSet, onManagerClear, onSimonCreated, onSimonDestroyed, onSimonReset, onStopwatchAdd, onStopwatchAdd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private org.slf4j.Logger logger

marker

private org.slf4j.Marker marker
Constructor Detail

SLF4JLoggingCallback

public SLF4JLoggingCallback()
Method Detail

onStopwatchStart

public void onStopwatchStart(Split split)
Logs Simon start on a sprecified log marker.

Specified by:
onStopwatchStart in interface Callback
Overrides:
onStopwatchStart in class CallbackSkeleton
Parameters:
split - started split

onStopwatchStop

public void onStopwatchStop(Split split,
                            StopwatchSample sample)
Logs Simon stop on a specified log marker.

Specified by:
onStopwatchStop in interface Callback
Overrides:
onStopwatchStop in class CallbackSkeleton
Parameters:
split - stopped split
sample -

onManagerWarning

public void onManagerWarning(String warning,
                             Exception cause)
Logs the warning on a specified log marker.

Specified by:
onManagerWarning in interface Callback
Overrides:
onManagerWarning in class CallbackSkeleton
Parameters:
warning - warning message
cause - throwable cause

onManagerMessage

public void onManagerMessage(String message)
Logs the message on a specified log marker.

Specified by:
onManagerMessage in interface Callback
Overrides:
onManagerMessage in class CallbackSkeleton
Parameters:
message - message

getLogger

public org.slf4j.Logger getLogger()
Returns logger used to log messages.

Returns:
used logger

setLogger

public void setLogger(org.slf4j.Logger logger)
Sets the logger that will be used to log messages.

Parameters:
logger - new specified logger

getMarker

public org.slf4j.Marker getMarker()
Returns the specified log marker for messages.

Returns:
log marker for messages

setMarker

public void setMarker(org.slf4j.Marker marker)
Sets the marker that will be used to log messages.

Parameters:
marker - log marker used to log messages

setMarker

public void setMarker(String marker)
Sets the marker via marker name - used by the configure facility to configure the callback.

Parameters:
marker - name of the marker


Copyright © 2013. All Rights Reserved.