All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sitewhere.spi.microservice.instance.EventPipelineLogLevel Maven / Gradle / Ivy

The newest version!
/**
 * Copyright © 2014-2021 The SiteWhere Authors
 *
 * 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.sitewhere.spi.microservice.instance;

/**
 * Log level for event pipeline log entries.
 */
public enum EventPipelineLogLevel {

    Error(4),

    Warning(3),

    Info(2),

    Debug(1);

    /** Level */
    private int level;

    private EventPipelineLogLevel(int level) {
	this.level = level;
    }

    public int getLevel() {
	return level;
    }

    /**
     * Get level based on first part of string.
     * 
     * @param prefix
     * @return
     */
    public static EventPipelineLogLevel getLevelForPrefix(String prefix) {
	prefix = prefix.toLowerCase();
	if (prefix.startsWith("err")) {
	    return Error;
	} else if (prefix.startsWith("war")) {
	    return Warning;
	} else if (prefix.startsWith("inf")) {
	    return Info;
	} else {
	    return Debug;
	}
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy