001/*
002 * Copyright 2022-2026 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;
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 a Soklet configuration option was requested but isn't supported in the current runtime/environment; behavior may differ (perhaps ignored or degraded).
032         */
033        CONFIGURATION_UNSUPPORTED,
034        /**
035         * Indicates that an exception was thrown during core request processing operations.
036         */
037        REQUEST_PROCESSING_FAILED,
038        /**
039         * Indicates {@link RequestInterceptor#wrapRequest(ServerType, Request, Consumer)} threw an exception.
040         */
041        REQUEST_INTERCEPTOR_WRAP_REQUEST_FAILED,
042        /**
043         * Indicates {@link RequestInterceptor#interceptRequest(ServerType, Request, ResourceMethod, Function, Consumer)} threw an exception.
044         */
045        REQUEST_INTERCEPTOR_INTERCEPT_REQUEST_FAILED,
046        /**
047         * Indicates {@link LifecycleObserver#willAcceptConnection(ServerType, java.net.InetSocketAddress)} threw an exception.
048         */
049        LIFECYCLE_OBSERVER_WILL_ACCEPT_CONNECTION_FAILED,
050        /**
051         * Indicates {@link LifecycleObserver#didAcceptConnection(ServerType, java.net.InetSocketAddress)} threw an exception.
052         */
053        LIFECYCLE_OBSERVER_DID_ACCEPT_CONNECTION_FAILED,
054        /**
055         * Indicates {@link LifecycleObserver#didFailToAcceptConnection(ServerType, java.net.InetSocketAddress, ConnectionRejectionReason, Throwable)} threw an exception.
056         */
057        LIFECYCLE_OBSERVER_DID_FAIL_TO_ACCEPT_CONNECTION_FAILED,
058        /**
059         * Indicates {@link LifecycleObserver#willAcceptRequest(ServerType, java.net.InetSocketAddress, String)} threw an exception.
060         */
061        LIFECYCLE_OBSERVER_WILL_ACCEPT_REQUEST_FAILED,
062        /**
063         * Indicates {@link LifecycleObserver#didAcceptRequest(ServerType, java.net.InetSocketAddress, String)} threw an exception.
064         */
065        LIFECYCLE_OBSERVER_DID_ACCEPT_REQUEST_FAILED,
066        /**
067         * Indicates {@link LifecycleObserver#didFailToAcceptRequest(ServerType, java.net.InetSocketAddress, String, RequestRejectionReason, Throwable)} threw an exception.
068         */
069        LIFECYCLE_OBSERVER_DID_FAIL_TO_ACCEPT_REQUEST_FAILED,
070        /**
071         * Indicates {@link LifecycleObserver#willReadRequest(ServerType, java.net.InetSocketAddress, String)} threw an exception.
072         */
073        LIFECYCLE_OBSERVER_WILL_READ_REQUEST_FAILED,
074        /**
075         * Indicates {@link LifecycleObserver#didReadRequest(ServerType, java.net.InetSocketAddress, String)} threw an exception.
076         */
077        LIFECYCLE_OBSERVER_DID_READ_REQUEST_FAILED,
078        /**
079         * Indicates {@link LifecycleObserver#didFailToReadRequest(ServerType, java.net.InetSocketAddress, String, RequestReadFailureReason, Throwable)} threw an exception.
080         */
081        LIFECYCLE_OBSERVER_DID_FAIL_TO_READ_REQUEST_FAILED,
082        /**
083         * Indicates {@link LifecycleObserver#didStartRequestHandling(ServerType, Request, ResourceMethod)} threw an exception.
084         */
085        LIFECYCLE_OBSERVER_DID_START_REQUEST_HANDLING_FAILED,
086        /**
087         * Indicates {@link LifecycleObserver#didFinishRequestHandling(ServerType, Request, ResourceMethod, MarshaledResponse, Duration, List)} threw an exception.
088         */
089        LIFECYCLE_OBSERVER_DID_FINISH_REQUEST_HANDLING_FAILED,
090        /**
091         * Indicates {@link LifecycleObserver#willWriteResponse(ServerType, Request, ResourceMethod, MarshaledResponse)}  threw an exception.
092         */
093        LIFECYCLE_OBSERVER_WILL_WRITE_RESPONSE_FAILED,
094        /**
095         * Indicates {@link LifecycleObserver#didWriteResponse(ServerType, Request, ResourceMethod, MarshaledResponse, Duration)}  or {@link LifecycleObserver#didFailToWriteResponse(ServerType, Request, ResourceMethod, MarshaledResponse, Duration, Throwable)} threw an exception.
096         */
097        LIFECYCLE_OBSERVER_DID_WRITE_RESPONSE_FAILED,
098        /**
099         * Indicates {@link LifecycleObserver#didCreateMcpSession(Request, Class, String)} threw an exception.
100         */
101        LIFECYCLE_OBSERVER_DID_CREATE_MCP_SESSION_FAILED,
102        /**
103         * Indicates {@link LifecycleObserver#didTerminateMcpSession(Class, String, Duration, McpSessionTerminationReason, Throwable)} threw an exception.
104         */
105        LIFECYCLE_OBSERVER_DID_TERMINATE_MCP_SESSION_FAILED,
106        /**
107         * Indicates {@link LifecycleObserver#didStartMcpRequestHandling(Request, Class, String, String, McpJsonRpcRequestId)} threw an exception.
108         */
109        LIFECYCLE_OBSERVER_DID_START_MCP_REQUEST_HANDLING_FAILED,
110        /**
111         * Indicates {@link LifecycleObserver#didFinishMcpRequestHandling(Request, Class, String, String, McpJsonRpcRequestId, McpRequestOutcome, McpJsonRpcError, Duration, List)} threw an exception.
112         */
113        LIFECYCLE_OBSERVER_DID_FINISH_MCP_REQUEST_HANDLING_FAILED,
114        /**
115         * Indicates {@link LifecycleObserver#didEstablishMcpSseStream(Request, Class, String)} threw an exception.
116         */
117        LIFECYCLE_OBSERVER_DID_ESTABLISH_MCP_SSE_STREAM_FAILED,
118        /**
119         * Indicates {@link LifecycleObserver#willTerminateMcpSseStream(Request, Class, String, McpStreamTerminationReason, Throwable)} threw an exception.
120         */
121        LIFECYCLE_OBSERVER_WILL_TERMINATE_MCP_SSE_STREAM_FAILED,
122        /**
123         * Indicates {@link LifecycleObserver#didTerminateMcpSseStream(Request, Class, String, Duration, McpStreamTerminationReason, Throwable)} threw an exception.
124         */
125        LIFECYCLE_OBSERVER_DID_TERMINATE_MCP_SSE_STREAM_FAILED,
126        /**
127         * Indicates {@link LifecycleObserver#willEstablishSseConnection(Request, ResourceMethod)} threw an exception.
128         */
129        LIFECYCLE_OBSERVER_WILL_ESTABLISH_SSE_CONNECTION_FAILED,
130        /**
131         * Indicates {@link LifecycleObserver#didEstablishSseConnection(SseConnection)} or {@link LifecycleObserver#didFailToEstablishSseConnection(Request, ResourceMethod, SseConnection.HandshakeFailureReason, Throwable)} threw an exception.
132         */
133        LIFECYCLE_OBSERVER_DID_ESTABLISH_SSE_CONNECTION_FAILED,
134        /**
135         * Indicates {@link LifecycleObserver#willTerminateSseConnection(SseConnection, SseConnection.TerminationReason, Throwable)} threw an exception.
136         */
137        LIFECYCLE_OBSERVER_WILL_TERMINATE_SSE_CONNECTION_FAILED,
138        /**
139         * Indicates {@link LifecycleObserver#didTerminateSseConnection(SseConnection, Duration, SseConnection.TerminationReason, Throwable)} threw an exception.
140         */
141        LIFECYCLE_OBSERVER_DID_TERMINATE_SSE_CONNECTION_FAILED,
142        /**
143         * Indicates {@link LifecycleObserver#willWriteSseEvent(SseConnection, SseEvent)} threw an exception.
144         */
145        LIFECYCLE_OBSERVER_WILL_WRITE_SSE_FAILED,
146        /**
147         * Indicates {@link LifecycleObserver#didWriteSseEvent(SseConnection, SseEvent, Duration)} or {@link LifecycleObserver#didFailToWriteSseEvent(SseConnection, SseEvent, Duration, Throwable)} threw an exception.
148         */
149        LIFECYCLE_OBSERVER_DID_WRITE_SSE_FAILED,
150        /**
151         * Indicates {@link LifecycleObserver#willWriteSseComment(SseConnection, SseComment)} threw an exception.
152         */
153        LIFECYCLE_OBSERVER_WILL_WRITE_SSE_COMMENT_FAILED,
154        /**
155         * Indicates {@link LifecycleObserver#didWriteSseComment(SseConnection, SseComment, Duration)} or {@link LifecycleObserver#didFailToWriteSseComment(SseConnection, SseComment, Duration, Throwable)} threw an exception.
156         */
157        LIFECYCLE_OBSERVER_DID_WRITE_SSE_COMMENT_FAILED,
158        /**
159         * Indicates a {@link MetricsCollector} invocation threw an exception.
160         */
161        METRICS_COLLECTOR_FAILED,
162        /**
163         * Indicates {@link ResponseMarshaler#forThrowable(Request, Throwable, ResourceMethod)} threw an exception.
164         */
165        RESPONSE_MARSHALER_FOR_THROWABLE_FAILED,
166        /**
167         * Indicates <em>Resource Method</em> resolution via ({@link ResourceMethodResolver#resourceMethodForRequest(Request, ServerType)} threw an exception.
168         */
169        RESOURCE_METHOD_RESOLUTION_FAILED,
170        /**
171         * Indicates that the {@link HttpServer} received a request with an illegal structure, such as a missing or invalid HTTP verb or an unsupported HTTP/2.0 request.
172         */
173        SERVER_UNPARSEABLE_REQUEST,
174        /**
175         * Indicates an internal {@link HttpServer} error occurred.
176         */
177        SERVER_INTERNAL_ERROR,
178        /**
179         * Indicates that the {@link SseServer} received a request with an illegal structure, such as a missing or invalid HTTP verb or an unsupported HTTP/2.0 request.
180         */
181        SSE_SERVER_UNPARSEABLE_REQUEST,
182        /**
183         * Indicates that the {@link SseServer} was unable to successfully write a handshake response.
184         */
185        SSE_SERVER_WRITING_HANDSHAKE_RESPONSE_FAILED,
186        /**
187         * Indicates that the {@link SseServer} encountered an error when executing application-provided code while performing a memoized broadcast via {@link SseBroadcaster#broadcastEvent(Function, Function)} or {@link SseBroadcaster#broadcastComment(Function, Function)}.
188         */
189        SSE_SERVER_BROADCAST_GENERATION_FAILED,
190        /**
191         * Indicates that the {@link SseServer} rejected a connection, e.g. due to capacity limits.
192         */
193        SSE_SERVER_CONNECTION_REJECTED,
194        /**
195         * Indicates an internal {@link SseServer} error occurred.
196         */
197        SSE_SERVER_INTERNAL_ERROR
198}