// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/ErrorData.java
// public class ErrorData {
// 
//     public static final int ERRORS_ID_LENGTH = 10;
// 
//     protected final String id;
//     protected final LoggingLevel loggingLevel;
//     protected final String requestMethod;
//     protected final String requestUri;
//     protected final HttpStatus responseStatus;
//     protected final List<Error> errors;
//     protected final Throwable throwable;
// 
//     protected ErrorData(String id, LoggingLevel loggingLevel, String requestMethod, String requestUri, HttpStatus responseStatus, List<Error> errors, Throwable throwable) {
//         this.id = id;
//         this.loggingLevel = loggingLevel;
//         this.requestMethod = requestMethod;
//         this.requestUri = requestUri;
//         this.responseStatus = responseStatus;
//         this.errors = errors;
//         this.throwable = throwable;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public LoggingLevel getLoggingLevel() {
//         return loggingLevel;
//     }
// 
//     public boolean hasLoggingLevel(LoggingLevel level) {
//         return loggingLevel == level;
//     }
// 
//     public String getRequestMethod() {
//         return requestMethod;
//     }
// 
//     public String getRequestUri() {
//         return requestUri;
//     }
// 
//     public HttpStatus getResponseStatus() {
//         return responseStatus;
//     }
// 
//     public List<Error> getErrors() {
//         return errors;
//     }
// 
//     public Throwable getThrowable() {
//         return throwable;
//     }
// 
//     public static final class ErrorDataBuilder {
// 
//         protected String id;
//         protected LoggingLevel loggingLevel;
//         protected String requestMethod;
//         protected String requestUri;
//         protected HttpStatus responseStatus;
//         protected List<Error> errors = new ErrorsLoggingList();
//         protected Throwable throwable;
// 
//         private ErrorDataBuilder() {
//             id = randomAlphanumeric(ERRORS_ID_LENGTH).toLowerCase();
//         }
// 
//         public static ErrorDataBuilder newErrorData() {
//             return new ErrorDataBuilder();
//         }
// 
//         public ErrorDataBuilder withLoggingLevel(LoggingLevel loggingLevel) {
//             this.loggingLevel = loggingLevel;
//             return this;
//         }
// 
//         public ErrorDataBuilder withRequestMethod(String requestMethod) {
//             this.requestMethod = requestMethod;
//             return this;
//         }
// 
//         public ErrorDataBuilder withRequestUri(String requestUri) {
//             this.requestUri = requestUri;
//             return this;
//         }
// 
//         public ErrorDataBuilder withResponseStatus(HttpStatus responseStatus) {
//             this.responseStatus = responseStatus;
//             return this;
//         }
// 
//         public ErrorDataBuilder addError(Error error) {
//             errors.add(error);
//             return this;
//         }
// 
//         public ErrorDataBuilder withThrowable(Throwable throwable) {
//             this.throwable = throwable;
//             return this;
//         }
// 
//         public ErrorData build() {
//             return new ErrorData(id, loggingLevel, requestMethod, requestUri, responseStatus, errors, throwable);
//         }
//     }
// }


import com.github.mkopylec.errorest.handling.errordata.ErrorData;
import org.slf4j.Logger;
import static com.github.mkopylec.errorest.logging.LoggingLevel.DEBUG;
import static com.github.mkopylec.errorest.logging.LoggingLevel.ERROR;
import static com.github.mkopylec.errorest.logging.LoggingLevel.INFO;
import static com.github.mkopylec.errorest.logging.LoggingLevel.TRACE;
import static com.github.mkopylec.errorest.logging.LoggingLevel.WARN;
import static org.slf4j.LoggerFactory.getLogger;
package com.github.mkopylec.errorest.logging;



public class ExceptionLogger {

    private static final Logger log = getLogger(ExceptionLogger.class);

    public void log(ErrorData errorData) {
        log(TRACE, errorData, () -> log.trace(createLogMessage(errorData), errorData.getThrowable()));
        log(DEBUG, errorData, () -> log.debug(createLogMessage(errorData), errorData.getThrowable()));
        log(INFO, errorData, () -> log.info(createLogMessage(errorData), errorData.getThrowable()));
        log(WARN, errorData, () -> log.warn(createLogMessage(errorData), errorData.getThrowable()));
        log(ERROR, errorData, () -> log.error(createLogMessage(errorData), errorData.getThrowable()));
    }

    protected void log(LoggingLevel loggingLevel, ErrorData errorData, Runnable logger) {
        if (!errorData.hasLoggingLevel(loggingLevel)) {
            return;
        }
        logger.run();
    }

    protected String createLogMessage(ErrorData errorData) {
// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/ErrorData.java
// public class ErrorData {
// 
//     public static final int ERRORS_ID_LENGTH = 10;
// 
//     protected final String id;
//     protected final LoggingLevel loggingLevel;
//     protected final String requestMethod;
//     protected final String requestUri;
//     protected final HttpStatus responseStatus;
//     protected final List<Error> errors;
//     protected final Throwable throwable;
// 
//     protected ErrorData(String id, LoggingLevel loggingLevel, String requestMethod, String requestUri, HttpStatus responseStatus, List<Error> errors, Throwable throwable) {
//         this.id = id;
//         this.loggingLevel = loggingLevel;
//         this.requestMethod = requestMethod;
//         this.requestUri = requestUri;
//         this.responseStatus = responseStatus;
//         this.errors = errors;
//         this.throwable = throwable;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public LoggingLevel getLoggingLevel() {
//         return loggingLevel;
//     }
// 
//     public boolean hasLoggingLevel(LoggingLevel level) {
//         return loggingLevel == level;
//     }
// 
//     public String getRequestMethod() {
//         return requestMethod;
//     }
// 
//     public String getRequestUri() {
//         return requestUri;
//     }
// 
//     public HttpStatus getResponseStatus() {
//         return responseStatus;
//     }
// 
//     public List<Error> getErrors() {
//         return errors;
//     }
// 
//     public Throwable getThrowable() {
//         return throwable;
//     }
// 
//     public static final class ErrorDataBuilder {
// 
//         protected String id;
//         protected LoggingLevel loggingLevel;
//         protected String requestMethod;
//         protected String requestUri;
//         protected HttpStatus responseStatus;
//         protected List<Error> errors = new ErrorsLoggingList();
//         protected Throwable throwable;
// 
//         private ErrorDataBuilder() {
//             id = randomAlphanumeric(ERRORS_ID_LENGTH).toLowerCase();
//         }
// 
//         public static ErrorDataBuilder newErrorData() {
//             return new ErrorDataBuilder();
//         }
// 
//         public ErrorDataBuilder withLoggingLevel(LoggingLevel loggingLevel) {
//             this.loggingLevel = loggingLevel;
//             return this;
//         }
// 
//         public ErrorDataBuilder withRequestMethod(String requestMethod) {
//             this.requestMethod = requestMethod;
//             return this;
//         }
// 
//         public ErrorDataBuilder withRequestUri(String requestUri) {
//             this.requestUri = requestUri;
//             return this;
//         }
// 
//         public ErrorDataBuilder withResponseStatus(HttpStatus responseStatus) {
//             this.responseStatus = responseStatus;
//             return this;
//         }
// 
//         public ErrorDataBuilder addError(Error error) {
//             errors.add(error);
//             return this;
//         }
// 
//         public ErrorDataBuilder withThrowable(Throwable throwable) {
//             this.throwable = throwable;
//             return this;
//         }
// 
//         public ErrorData build() {
//             return new ErrorData(id, loggingLevel, requestMethod, requestUri, responseStatus, errors, throwable);
//         }
//     }
// }


// Path: src/main/java/com/github/mkopylec/errorest/logging/ExceptionLogger.java
import com.github.mkopylec.errorest.handling.errordata.ErrorData;
import org.slf4j.Logger;
import static com.github.mkopylec.errorest.logging.LoggingLevel.DEBUG;
import static com.github.mkopylec.errorest.logging.LoggingLevel.ERROR;
import static com.github.mkopylec.errorest.logging.LoggingLevel.INFO;
import static com.github.mkopylec.errorest.logging.LoggingLevel.TRACE;
import static com.github.mkopylec.errorest.logging.LoggingLevel.WARN;
import static org.slf4j.LoggerFactory.getLogger;

package com.github.mkopylec.errorest.logging;



public class ExceptionLogger {

    private static final Logger log = getLogger(ExceptionLogger.class);

    public void log(ErrorData errorData) {
        log(TRACE, errorData, () -> log.trace(createLogMessage(errorData), errorData.getThrowable()));
        log(DEBUG, errorData, () -> log.debug(createLogMessage(errorData), errorData.getThrowable()));
        log(INFO, errorData, () -> log.info(createLogMessage(errorData), errorData.getThrowable()));
        log(WARN, errorData, () -> log.warn(createLogMessage(errorData), errorData.getThrowable()));
        log(ERROR, errorData, () -> log.error(createLogMessage(errorData), errorData.getThrowable()));
    }

    protected void log(LoggingLevel loggingLevel, ErrorData errorData, Runnable logger) {
        if (!errorData.hasLoggingLevel(loggingLevel)) {
            return;
        }
        logger.run();
    }

    protected String createLogMessage(ErrorData errorData) {
        return "ID: " + errorData.getId() + " | " + errorData.getRequestMethod() + " " + errorData.getRequestUri() + " " + errorData.getResponseStatus() + " | " + errorData.getErrors();