]> git.basschouten.com Git - openhab-addons.git/blob
af85dcd2056c9188b84bd6bb4194b91dc5e5a9af
[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.ojelectronics.internal.common;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.slf4j.LoggerFactory;
18
19 import com.github.signalr4j.client.LogLevel;
20 import com.github.signalr4j.client.Logger;
21
22 /**
23  * Logs SignalR information
24  *
25  * @author Christian Kittel - Initial Contribution
26  */
27 @NonNullByDefault
28 public class SignalRLogger implements Logger {
29
30     private final org.slf4j.Logger logger = LoggerFactory.getLogger(SignalRLogger.class);
31
32     @Override
33     public void log(@Nullable String message, @Nullable LogLevel level) {
34         if (message == null || level == null) {
35             return;
36         }
37         switch (level) {
38             case Critical:
39                 logger.warn("Critical SignalR Message: {}", message);
40                 break;
41             case Information:
42                 logger.info("SignalR information message: {}", message);
43                 break;
44             case Verbose:
45             default:
46                 logger.trace("SignalR information message: {}", message);
47                 break;
48         }
49     }
50 }