aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/main/java/com/yahoo/config/subscription/ConfigDebug.java
blob: 85aa7a05e17f7710cec4160b6cb01d3cba658949 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.subscription;

import com.yahoo.config.ConfigInstance;
import com.yahoo.vespa.config.ConfigKey;

import java.util.logging.Logger;

import static java.util.logging.Level.INFO;

// Debug class that provides useful helper routines
public class ConfigDebug {
    public static void logDebug(Logger logger, long timestamp, ConfigKey<?> key, String logmessage) {
        if (key.getConfigId().matches(".*container.?\\d+.*") || key.getConfigId().matches(".*doc.api.*")) {
            logger.log(INFO, timestamp + " " + key + " " + logmessage);
        }
    }

    public static void logDebug(Logger log, ConfigInstance.Builder builder, String configId, String logmessage) {
        ConfigKey<?> key = new ConfigKey<>(builder.getDefName(), configId, builder.getDefNamespace());
        logDebug(log, 0, key, logmessage);
    }
}