InternalLogConfigurationEntry.java 1.1 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  ch.qos.logback.classic.Level
 */
package com.adobe.granite.logging.impl;

import ch.qos.logback.classic.Level;
import com.adobe.granite.logging.LogConfigurationEntry;
import com.adobe.granite.logging.LogLevel;

public class InternalLogConfigurationEntry
extends LogConfigurationEntry {
    private final String prefix;
    private final Level level;

    public InternalLogConfigurationEntry(LogConfigurationEntry entry) {
        super(entry.getLogLevel(), entry.getLoggerName());
        this.prefix = entry.getLoggerName() == null || entry.getLoggerName().length() == 0 || "root".equalsIgnoreCase(entry.getLoggerName()) ? null : entry.getLoggerName() + ".";
        this.level = Level.toLevel((String)entry.getLogLevel().name(), (Level)Level.ERROR);
    }

    public boolean matches(String loggerName, Level loglevel) {
        if ((this.prefix == null || loggerName.equals(this.getLoggerName()) || loggerName.startsWith(this.prefix)) && loglevel.isGreaterOrEqual(this.level)) {
            return true;
        }
        return false;
    }
}