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#willEstablishServerSentEventConnection(Request, ResourceMethod)} threw an exception.
100         */
101        LIFECYCLE_OBSERVER_WILL_ESTABLISH_SERVER_SENT_EVENT_CONNECTION_FAILED,
102        /**
103         * Indicates {@link LifecycleObserver#didEstablishServerSentEventConnection(ServerSentEventConnection)} or {@link LifecycleObserver#didFailToEstablishServerSentEventConnection(Request, ResourceMethod, ServerSentEventConnection.HandshakeFailureReason, Throwable)} threw an exception.
104         */
105        LIFECYCLE_OBSERVER_DID_ESTABLISH_SERVER_SENT_EVENT_CONNECTION_FAILED,
106        /**
107         * Indicates {@link LifecycleObserver#willTerminateServerSentEventConnection(ServerSentEventConnection, ServerSentEventConnection.TerminationReason, Throwable)} threw an exception.
108         */
109        LIFECYCLE_OBSERVER_WILL_TERMINATE_SERVER_SENT_EVENT_CONNECTION_FAILED,
110        /**
111         * Indicates {@link LifecycleObserver#didTerminateServerSentEventConnection(ServerSentEventConnection, Duration, ServerSentEventConnection.TerminationReason, Throwable)} threw an exception.
112         */
113        LIFECYCLE_OBSERVER_DID_TERMINATE_SERVER_SENT_EVENT_CONNECTION_FAILED,
114        /**
115         * Indicates {@link LifecycleObserver#willWriteServerSentEvent(ServerSentEventConnection, ServerSentEvent)} threw an exception.
116         */
117        LIFECYCLE_OBSERVER_WILL_WRITE_SERVER_SENT_EVENT_FAILED,
118        /**
119         * Indicates {@link LifecycleObserver#didWriteServerSentEvent(ServerSentEventConnection, ServerSentEvent, Duration)} or {@link LifecycleObserver#didFailToWriteServerSentEvent(ServerSentEventConnection, ServerSentEvent, Duration, Throwable)} threw an exception.
120         */
121        LIFECYCLE_OBSERVER_DID_WRITE_SERVER_SENT_EVENT_FAILED,
122        /**
123         * Indicates {@link LifecycleObserver#willWriteServerSentEventComment(ServerSentEventConnection, ServerSentEventComment)} threw an exception.
124         */
125        LIFECYCLE_OBSERVER_WILL_WRITE_SERVER_SENT_EVENT_COMMENT_FAILED,
126        /**
127         * Indicates {@link LifecycleObserver#didWriteServerSentEventComment(ServerSentEventConnection, ServerSentEventComment, Duration)} or {@link LifecycleObserver#didFailToWriteServerSentEventComment(ServerSentEventConnection, ServerSentEventComment, Duration, Throwable)} threw an exception.
128         */
129        LIFECYCLE_OBSERVER_DID_WRITE_SERVER_SENT_EVENT_COMMENT_FAILED,
130        /**
131         * Indicates a {@link MetricsCollector} invocation threw an exception.
132         */
133        METRICS_COLLECTOR_FAILED,
134        /**
135         * Indicates {@link ResponseMarshaler#forThrowable(Request, Throwable, ResourceMethod)} threw an exception.
136         */
137        RESPONSE_MARSHALER_FOR_THROWABLE_FAILED,
138        /**
139         * Indicates <em>Resource Method</em> resolution via ({@link ResourceMethodResolver#resourceMethodForRequest(Request, ServerType)} threw an exception.
140         */
141        RESOURCE_METHOD_RESOLUTION_FAILED,
142        /**
143         * Indicates that the {@link Server} received a request with an illegal structure, such as a missing or invalid HTTP verb or an unsupported HTTP/2.0 request.
144         */
145        SERVER_UNPARSEABLE_REQUEST,
146        /**
147         * Indicates an internal {@link Server} error occurred.
148         */
149        SERVER_INTERNAL_ERROR,
150        /**
151         * Indicates that the {@link ServerSentEventServer} received a request with an illegal structure, such as a missing or invalid HTTP verb or an unsupported HTTP/2.0 request.
152         */
153        SERVER_SENT_EVENT_SERVER_UNPARSEABLE_REQUEST,
154        /**
155         * Indicates that the {@link ServerSentEventServer} was unable to successfully write a handshake response.
156         */
157        SERVER_SENT_EVENT_SERVER_WRITING_HANDSHAKE_RESPONSE_FAILED,
158        /**
159         * Indicates that the {@link ServerSentEventServer} encountered an error when executing application-provided code while performing a memoized broadcast via {@link ServerSentEventBroadcaster#broadcastEvent(Function, Function)} or {@link ServerSentEventBroadcaster#broadcastComment(Function, Function)}.
160         */
161        SERVER_SENT_EVENT_SERVER_BROADCAST_GENERATION_FAILED,
162        /**
163         * Indicates that the {@link ServerSentEventServer} rejected a connection, e.g. due to capacity limits.
164         */
165        SERVER_SENT_EVENT_SERVER_CONNECTION_REJECTED,
166        /**
167         * Indicates an internal {@link ServerSentEventServer} error occurred.
168         */
169        SERVER_SENT_EVENT_SERVER_INTERNAL_ERROR
170}