All Downloads are FREE. Search and download functionalities are using the official Maven repository.

querqy.lucene.rewrite.infologging.InfoLoggingContext Maven / Gradle / Ivy

The newest version!
package querqy.lucene.rewrite.infologging;

import querqy.rewrite.SearchEngineRequestAdapter;

/**
 * Per-request access to InfoLogging
 */
public class InfoLoggingContext {

    private final InfoLogging infoLogging;
    private final SearchEngineRequestAdapter searchEngineRequestAdapter;

    private String rewriterId = null;

    public InfoLoggingContext(final InfoLogging infoLogging,
                              final SearchEngineRequestAdapter searchEngineRequestAdapter) {
        this.infoLogging = infoLogging;
        this.searchEngineRequestAdapter = searchEngineRequestAdapter;
    }

    public String getRewriterId() {
        return rewriterId;
    }

    public void setRewriterId(final String rewriterId) {
        this.rewriterId = rewriterId;
    }

    public void log(final Object message) {
        infoLogging.log(message, rewriterId, searchEngineRequestAdapter);
    }

    public void endOfRequest() {
        infoLogging.endOfRequest(searchEngineRequestAdapter);
    }

    public boolean isEnabledForRewriter() {
        return infoLogging.isLoggingEnabledForRewriter(rewriterId);
    }



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy