001/* 002 * Copyright 2009-2020 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2009-2020 Ping Identity Corporation 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020/* 021 * Copyright (C) 2015-2020 Ping Identity Corporation 022 * 023 * This program is free software; you can redistribute it and/or modify 024 * it under the terms of the GNU General Public License (GPLv2 only) 025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 026 * as published by the Free Software Foundation. 027 * 028 * This program is distributed in the hope that it will be useful, 029 * but WITHOUT ANY WARRANTY; without even the implied warranty of 030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 031 * GNU General Public License for more details. 032 * 033 * You should have received a copy of the GNU General Public License 034 * along with this program; if not, see <http://www.gnu.org/licenses>. 035 */ 036package com.unboundid.ldap.sdk.unboundidds.logs; 037 038 039 040import com.unboundid.util.StaticUtils; 041import com.unboundid.util.ThreadSafety; 042import com.unboundid.util.ThreadSafetyLevel; 043 044 045 046/** 047 * This enum contains the set of error log severities defined in the Directory 048 * Server. 049 * <BR> 050 * <BLOCKQUOTE> 051 * <B>NOTE:</B> This class, and other classes within the 052 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 053 * supported for use against Ping Identity, UnboundID, and 054 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 055 * for proprietary functionality or for external specifications that are not 056 * considered stable or mature enough to be guaranteed to work in an 057 * interoperable way with other types of LDAP servers. 058 * </BLOCKQUOTE> 059 */ 060@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 061public enum ErrorLogSeverity 062{ 063 /** 064 * The severity that will be used for messages providing debugging 065 * information. 066 */ 067 DEBUG, 068 069 070 071 /** 072 * The severity that will be used for fatal error messages, which indicate 073 * that the server can no longer continue functioning normally. 074 */ 075 FATAL_ERROR, 076 077 078 /** 079 * The severity that will be used for informational messages which may be 080 * useful but generally do not need to be written to log files. 081 */ 082 INFORMATION, 083 084 085 086 /** 087 * The severity that will be used for messages about errors that are small in 088 * scope and do not generally impact the operation of the server. 089 */ 090 MILD_ERROR, 091 092 093 094 /** 095 * The severity that will be used for warnings about conditions that do not 096 * generally impact the operation of the server. 097 */ 098 MILD_WARNING, 099 100 101 /** 102 * The severity that will be used for significant informational messages that 103 * should generally be visible to administrators. 104 */ 105 NOTICE, 106 107 108 /** 109 * The severity that will be used for messages about errors that may impact 110 * the operation of the server or one of its components. 111 */ 112 SEVERE_ERROR, 113 114 115 /** 116 * The severity that will be used for warning messages about conditions that 117 * may impact the operation of the server or one of its components. 118 */ 119 SEVERE_WARNING; 120 121 122 123 /** 124 * Retrieves the error log severity with the specified name. 125 * 126 * @param name The name of the error log severity to retrieve. It must not 127 * be {@code null}. 128 * 129 * @return The requested error log severity, or {@code null} if no such 130 * severity is defined. 131 */ 132 public static ErrorLogSeverity forName(final String name) 133 { 134 switch (StaticUtils.toLowerCase(name)) 135 { 136 case "debug": 137 return DEBUG; 138 case "fatalerror": 139 case "fatal-error": 140 case "fatal_error": 141 return FATAL_ERROR; 142 case "information": 143 return INFORMATION; 144 case "milderror": 145 case "mild-error": 146 case "mild_error": 147 return MILD_ERROR; 148 case "mildwarning": 149 case "mild-warning": 150 case "mild_warning": 151 return MILD_WARNING; 152 case "notice": 153 return NOTICE; 154 case "severeerror": 155 case "severe-error": 156 case "severe_error": 157 return SEVERE_ERROR; 158 case "severewarning": 159 case "severe-warning": 160 case "severe_warning": 161 return SEVERE_WARNING; 162 default: 163 return null; 164 } 165 } 166}