APISonar


io.micrometer.core.util.internal.logging.WarnThenDebugLogger.log

> io > micrometer > core > util > internal > logging > WarnThenDebugLogger > log
io APIs micrometer APIs core APIs util APIs internal APIs logging APIs WarnThenDebugLogger APIs log APIs

Example 1
private static final WarnThenDebugLogger logger = new WarnThenDebugLogger(DefaultGauge.class);

    public double value() {
        T obj = ref.get();
        if (obj != null) {
            try {
                return value.applyAsDouble(ref.get());
            }
            catch (Throwable ex) {
                logger.log("Failed to apply the value function for the gauge '" + getId().getName() + "'.", ex);
            }
        }
        return Double.NaN;
    }
Example 2
private static final WarnThenDebugLogger logger = new WarnThenDebugLogger(DynatraceNamingConvention.class);

    private String sanitizeName(String name) {
        if (name.equals("system.load.average.1m")) {
            return "system.load.average.oneminute";
        }
        String sanitized = NAME_CLEANUP_PATTERN.matcher(name).replaceAll("_");
        if (LEADING_NUMERIC_PATTERN.matcher(sanitized).find()) {
            logger.log("'" + sanitized + "' (original name: '" + name + "') is not a valid meter name. "
                    + "Dynatrace doesn't allow leading numeric characters after non-alphabets. "
                    + "Please rename it to conform to the constraints. "
                    + "If it comes from a third party, please use MeterFilter to rename it.");
        }
        return sanitized;
    }