001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.rest.logger; 014 015import org.apache.juneau.common.internal.*; 016 017/** 018 * Represents the amount of detail to include in a log entry for HTTP requests and responses. 019 * 020 * <h5 class='section'>See Also:</h5><ul> 021 * <li class='link'><a class="doclink" href="../../../../../index.html#jrs.LoggingAndDebugging">Logging / Debugging</a> 022 * </ul> 023 */ 024public enum CallLoggingDetail { 025 026 /** 027 * Lowest detail - Log only the request and response status lines. 028 */ 029 STATUS_LINE, 030 031 /** 032 * Medium detail - Log status lines and also headers. 033 */ 034 HEADER, 035 036 /** 037 * Highest detail - Log status lines, headers, and bodies if available. 038 */ 039 ENTITY; 040 041 boolean isOneOf(CallLoggingDetail...values) { 042 for (CallLoggingDetail v : values) 043 if (v == this) 044 return true; 045 return false; 046 } 047 048 /** 049 * Retrieves this enum using case-insensitive matching. 050 * 051 * @param s The enum name to resolve. 052 * @return The resolved value. 053 */ 054 public static CallLoggingDetail fromString(String s) { 055 if (! StringUtils.isEmpty(s)) { 056 try { 057 return valueOf(s.toUpperCase()); 058 } catch (IllegalArgumentException e) {} 059 } 060 return null; 061 } 062}