001/*
002 * Copyright 2022-2025 Revetware LLC.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.soklet.core;
018
019import java.time.Duration;
020import java.util.List;
021import java.util.function.Consumer;
022import java.util.function.Function;
023
024/**
025 * Kinds of {@link LogEvent} instances that Soklet can produce.
026 *
027 * @author <a href="https://www.revetkn.com">Mark Allen</a>
028 */
029public enum LogEventType {
030        /**
031         * Indicates that an exception was thrown during core request processing operations.
032         */
033        REQUEST_PROCESSING_FAILED,
034        /**
035         * Indicates {@link LifecycleInterceptor#wrapRequest(Request, ResourceMethod, Consumer)} threw an exception.
036         */
037        LIFECYCLE_INTERCEPTOR_WRAP_REQUEST_FAILED,
038        /**
039         * Indicates {@link LifecycleInterceptor#interceptRequest(Request, ResourceMethod, Function, Consumer)} threw an exception.
040         */
041        LIFECYCLE_INTERCEPTOR_INTERCEPT_REQUEST_FAILED,
042        /**
043         * Indicates {@link LifecycleInterceptor#didStartRequestHandling(Request, ResourceMethod)} threw an exception.
044         */
045        LIFECYCLE_INTERCEPTOR_DID_START_REQUEST_HANDLING_FAILED,
046        /**
047         * Indicates {@link LifecycleInterceptor#didFinishRequestHandling(Request, ResourceMethod, MarshaledResponse, Duration, List)} threw an exception.
048         */
049        LIFECYCLE_INTERCEPTOR_DID_FINISH_REQUEST_HANDLING_FAILED,
050        /**
051         * Indicates {@link LifecycleInterceptor#willStartResponseWriting(Request, ResourceMethod, MarshaledResponse)} threw an exception.
052         */
053        LIFECYCLE_INTERCEPTOR_WILL_START_RESPONSE_WRITING_FAILED,
054        /**
055         * Indicates {@link LifecycleInterceptor#didFinishResponseWriting(Request, ResourceMethod, MarshaledResponse, Duration, Throwable)} threw an exception.
056         */
057        LIFECYCLE_INTERCEPTOR_DID_FINISH_RESPONSE_WRITING_FAILED,
058        /**
059         * Indicates {@link LifecycleInterceptor#willEstablishServerSentEventConnection(Request, ResourceMethod)} threw an exception.
060         */
061        LIFECYCLE_INTERCEPTOR_WILL_ESTABLISH_SERVER_SENT_EVENT_CONNECTION_FAILED,
062        /**
063         * Indicates {@link LifecycleInterceptor#didEstablishServerSentEventConnection(Request, ResourceMethod)} threw an exception.
064         */
065        LIFECYCLE_INTERCEPTOR_DID_ESTABLISH_SERVER_SENT_EVENT_CONNECTION_FAILED,
066        /**
067         * Indicates {@link LifecycleInterceptor#willTerminateServerSentEventConnection(Request, ResourceMethod, Throwable)} threw an exception.
068         */
069        LIFECYCLE_INTERCEPTOR_WILL_TERMINATE_SERVER_SENT_EVENT_CONNECTION_FAILED,
070        /**
071         * Indicates {@link LifecycleInterceptor#didTerminateServerSentEventConnection(Request, ResourceMethod, Duration, Throwable)} threw an exception.
072         */
073        LIFECYCLE_INTERCEPTOR_DID_TERMINATE_SERVER_SENT_EVENT_CONNECTION_FAILED,
074        /**
075         * Indicates {@link LifecycleInterceptor#willStartServerSentEventWriting(Request, ResourceMethod, ServerSentEvent)} threw an exception.
076         */
077        LIFECYCLE_INTERCEPTOR_WILL_START_SERVER_SENT_EVENT_WRITING_FAILED,
078        /**
079         * Indicates {@link LifecycleInterceptor#didFinishServerSentEventWriting(Request, ResourceMethod, ServerSentEvent, Duration, Throwable)} threw an exception.
080         */
081        LIFECYCLE_INTERCEPTOR_DID_FINISH_SERVER_SENT_EVENT_WRITING_FAILED,
082        /**
083         * Indicates {@link ResponseMarshaler#forThrowable(Request, Throwable, ResourceMethod)} threw an exception.
084         */
085        RESPONSE_MARSHALER_FOR_THROWABLE_FAILED,
086        /**
087         * Indicates <em>Resource Method</em> resolution via ({@link ResourceMethodResolver#resourceMethodForRequest(Request)} threw an exception.
088         */
089        RESOURCE_METHOD_RESOLUTION_FAILED,
090        /**
091         * Indicates an internal {@link Server} error occurred.
092         */
093        SERVER_INTERNAL_ERROR,
094        /**
095         * Indicates an internal {@link ServerSentEventServer} error occurred.
096         */
097        SERVER_SENT_EVENT_SERVER_INTERNAL_ERROR
098}