summaryrefslogtreecommitdiffstats
path: root/config/src/main/java/com/yahoo/config/subscription/ConfigDebug.java
blob: 3020f49b32e6afc360d1c71d89e375936f883464 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright 2017 Yahoo Holdings. 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.log.LogLevel;
import com.yahoo.vespa.config.ConfigKey;

import java.util.logging.Logger;

// 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(LogLevel.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);
    }
}