]> git.basschouten.com Git - openhab-addons.git/blob
062794e75828117504332c0a90c55a2c215d15b2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.neeo.internal.net;
14
15 import java.util.Objects;
16 import java.util.logging.LogRecord;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.slf4j.Logger;
21
22 /**
23  * Logging adapter to use for Slf4j
24  *
25  * @author Tim Roberts - Initial Contribution
26  */
27 @NonNullByDefault
28 class Slf4LoggingAdapter extends java.util.logging.Logger {
29
30     /** The logger. */
31     private final Logger logger;
32
33     /**
34      * Creates the logging adapter from the given logger
35      *
36      * @param logger a non-null logger to use
37      */
38     protected Slf4LoggingAdapter(Logger logger) {
39         super("jersey", null);
40         Objects.requireNonNull(logger, "logger cannot be null");
41         this.logger = logger;
42     }
43
44     @Override
45     public void log(@Nullable LogRecord record) {
46         logger.debug("{}", record == null ? "" : record.getMessage());
47     }
48 }