bachelor-thesis/chapters/thesis/appendix05_Logger.java

46 lines
1.9 KiB
Java
Raw Normal View History

2024-09-08 00:33:09 +02:00
public class VdlLogger extends ViewDeclarationLanguageWrapper {
private static final Logger logger_= Logger.getLogger(VdlLogger.class.getName());
private final ViewDeclarationLanguage wrapped;
public VdlLogger(ViewDeclarationLanguage wrapped) {
this.wrapped = wrapped;;
}
@Override
public UIViewRoot createView(FacesContext context, String viewId) {
long start = System.nanoTime();
UIViewRoot view = super.createView(context, viewId);
long end = System.nanoTime();
logger_.severe(String.format("PerformanceCounter-create %s: %.6f ms", viewId, (end - start) / 1e6));
return view;
}
@Override
public void buildView(FacesContext context, UIViewRoot view) throws FacesException, IOException {
long start = System.nanoTime();
super.buildView(context, view);
long end = System.nanoTime();
logger_.severe(String.format("PerformanceCounter-build %s: %.6f ms", view.getViewId(), (end - start) / 1e6));
}
@Override
public void renderView(FacesContext context, UIViewRoot view) throws FacesException, IOException {
long start = System.nanoTime();
super.renderView(context, view);
long end = System.nanoTime();
logger_.severe(String.format("PerformanceCounter-render %s: %.6f ms", view.getViewId(), (end - start) / 1e6));
}
@Override
public UIComponent createComponent(FacesContext context, String taglibURI, String tagName, Map<String, Object> attributes) {
long start = System.nanoTime();
UIComponent component = super.createComponent(context, taglibURI, tagName, attributes);
long end = System.nanoTime();
logger_.severe(String.format("PerformanceCounter-creatc $s: %.6f ms", taglibURI, (end - start) / 1e6));
return component;
}
@Override
public ViewDeclarationLanguage getWrapped() { return wrapped; }
}