package com.avg.zaap.crashlibrary.provider.stacktrace;

import android.support.annotation.NonNull;

/**
 * This interface defines the common behavior for stacktrace writers.
 * <p>
 * Created by marek.osvald on 27. 4. 2016.
 */
public interface IStackTraceWriter {

    /**
     * Write crashing stack trace to provided directory.
     *
     * @param directory file name for writing
     * @param throwable throwable which crashed the thread
     * @return file path which contains serialized stacktrace of crashed thread
     * @throws StackTraceWriterException provided that writing stack trace fails
     */
    String writeCrashingThreadStackTrace(@NonNull String directory, @NonNull Throwable throwable) throws StackTraceWriterException;

    /**
     * Write all stack traces to provided directory.
     *
     * @param directory file name for writing
     * @return file path which contains serialized stack traces of all threads
     * @throws StackTraceWriterException provided that writing stack traces fails
     */
    String writeAllStackTraces(@NonNull String directory) throws StackTraceWriterException;

}
