// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
package logging.log4j2;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class TestLambda {
    private static final Logger log = LogManager.getLogger(TestLambda.class);
    public static int fac(int n) {
        int res;
        if (n <= 1) {
            res = 1;
        } else {
            res = n * fac(n - 1);
        }
        log.debug(() -> "fac : n = " + n + " res = " + res);
        return res;
    }
    public static void main(String[] args) {
        log.info("Start");
        System.out.println(fac(50));
        log.info("End");
    }
}
