aboutsummaryrefslogtreecommitdiffstats
path: root/docprocs/src/main/java/com/yahoo/docprocs/indexing/FastLogger.java
blob: 96562d2f585c60105d973a601fb21f807c7936c1 (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
24
25
26
27
28
29
30
31
32
33
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.docprocs.indexing;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author Simon Thoresen Hult
 */
class FastLogger {

    private final Logger log;

    private FastLogger(Logger log) {
        this.log = log;
    }

    public void log(Level level, String format, Object... args) {
        if (!log.isLoggable(level)) {
            return;
        }
        if (args.length > 0) {
            log.log(level, String.format(format, args));
        } else {
            log.log(level, format);
        }
    }

    public static FastLogger getLogger(String name) {
        return new FastLogger(Logger.getLogger(name));
    }

}