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

com.github.dreamhead.moco.monitor.LogMonitor Maven / Gradle / Ivy

Go to download

Moco is an easy setup stub framework, mainly focusing on testing and integration.

There is a newer version: 1.5.0
Show newest version
package com.github.dreamhead.moco.monitor;

import com.github.dreamhead.moco.Request;
import com.github.dreamhead.moco.Response;

public class LogMonitor extends AbstractMonitor {
    private final LogWriter writer;
    private final LogFormatter formatter;

    public LogMonitor(final LogFormatter formatter, final LogWriter writer) {
        this.writer = writer;
        this.formatter = formatter;
    }

    @Override
    public void onMessageArrived(final Request request) {
        writer.write(formatter.format(request));
    }

    @Override
    public void onException(final Throwable t) {
        writer.write(formatter.format(t));
    }

    @Override
    public void onMessageLeave(final Response response) {
        writer.write(formatter.format(response));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy