-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ceki Gulcu <[email protected]>
- Loading branch information
Showing
1 changed file
with
50 additions
and
1 deletion.
There are no files selected for viewing
51 changes: 50 additions & 1 deletion
51
logback-classic/src/main/java/ch/qos/logback/classic/util/LevelUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,51 @@ | ||
package ch.qos.logback.classic.util;public class LevelUtil { | ||
/* | ||
* Logback: the reliable, generic, fast and flexible logging framework. | ||
* Copyright (C) 1999-2024, QOS.ch. All rights reserved. | ||
* | ||
* This program and the accompanying materials are dual-licensed under | ||
* either the terms of the Eclipse Public License v1.0 as published by | ||
* the Eclipse Foundation | ||
* | ||
* or (per the licensee's choosing) | ||
* | ||
* under the terms of the GNU Lesser General Public License version 2.1 | ||
* as published by the Free Software Foundation. | ||
*/ | ||
|
||
package ch.qos.logback.classic.util; | ||
|
||
import ch.qos.logback.classic.Level; | ||
import ch.qos.logback.core.joran.JoranConstants; | ||
import ch.qos.logback.core.util.OptionHelper; | ||
|
||
import static ch.qos.logback.core.joran.JoranConstants.NULL; | ||
|
||
/** | ||
* | ||
* Utility methods for transforming string values to Level. | ||
* | ||
* @since 1.5.1 | ||
*/ | ||
public class LevelUtil { | ||
|
||
|
||
public static boolean isInheritedLevelString(String levelStr) { | ||
if (JoranConstants.INHERITED.equalsIgnoreCase(levelStr) || NULL.equalsIgnoreCase(levelStr)) { | ||
return true; | ||
} else | ||
return false; | ||
} | ||
|
||
public static Level levelStringToLevel(String levelStr) { | ||
if (!OptionHelper.isNullOrEmptyOrAllSpaces(levelStr)) { | ||
if (isInheritedLevelString(levelStr)) { | ||
return null; | ||
} else { | ||
Level level = Level.toLevel(levelStr); | ||
return level; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
} |