/*
 * Copyright 2017 The RoboZonky Project
 *
 * 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.github.robozonky.app.configuration.daemon;

import java.util.function.Supplier;

final class Skippable implements Runnable {

    private final Supplier<Boolean> shouldBeSkipped;
    private final Runnable toRun;

    public Skippable(final Runnable toRun, final Supplier<Boolean> shouldBeSkipped) {
        this.shouldBeSkipped = shouldBeSkipped;
        this.toRun = toRun;
    }

    @Override
    public void run() {
        if (shouldBeSkipped.get()) {
            return;
        }
        toRun.run();
    }

    @Override
    public String toString() {
        return "Skippable{" +
                "toRun=" + toRun +
                '}';
    }
}

@@ -696,51 +696,193 @@
 r;%0A%0A
-final class Skippable implements Runnable %7B
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Afinal class Skippable implements Runnable %7B%0A%0A    private static final Logger LOGGER = LoggerFactory.getLogger(Skippable.class);
 %0A%0A  
@@ -1186,85 +1186,286 @@
     
-if (shouldBeSkipped.get()) %7B%0A            return;%0A        %7D%0A        toRun.run(
+LOGGER.trace(%22Checking whether to run the update.%22);%0A        if (shouldBeSkipped.get()) %7B%0A            LOGGER.trace(%22Not running the update.%22);%0A            return;%0A        %7D%0A        LOGGER.trace(%22Running the update.%22);%0A        toRun.run();%0A        LOGGER.trace(%22Update finished.%22
 );%0A 

Add trace logging around Skippable