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