com.github.michelzanini.logger.LoggerLevel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-logger Show documentation
Show all versions of android-logger Show documentation
Simple Log Wrapper over android.util.Log class
The newest version!
/*******************************************************************************
* Copyright 2013 AppGlu, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.github.michelzanini.logger;
import android.util.Log;
/**
* Represents the level that the log message will be logged.
* Levels are used to filter log messages that are too specific. For example, when the {@code LoggerLevel} is {@link #INFO}, then {@link #VERBOSE} and {@link #DEBUG} messages are not logged.
*
* @see LoggerFactory
* @since 1.0.0
*/
public enum LoggerLevel {
VERBOSE (Log.VERBOSE),
DEBUG (Log.DEBUG),
INFO (Log.INFO),
WARN (Log.WARN),
ERROR (Log.ERROR),
NONE (LoggerLevel.NONE_CONSTANT);
private static final int NONE_CONSTANT = 99;
private final int androidLevel;
LoggerLevel(int androidLevel) {
this.androidLevel = androidLevel;
}
public int getLevelAsInteger() {
return androidLevel;
}
public static LoggerLevel getLoggerLevel(String levelString) {
for (LoggerLevel level : values()) {
if (level.toString().equalsIgnoreCase(levelString)) {
return level;
}
}
return NONE;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy