001/** 002 * Copyright (C) 2019 Michael N. Lipp (http://www.mnl.de) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.slf4j.impl; 018 019import de.mnl.osgi.lf4osgi.core.LoggerFacade; 020import de.mnl.osgi.lf4osgi.core.LoggerFacadeManager; 021import de.mnl.osgi.lf4osgi.core.LoggerGroup; 022import org.osgi.service.log.LoggerFactory; 023import org.slf4j.helpers.MarkerIgnoringBase; 024 025/** 026 * The Class Fwd2OsgiLogger. 027 */ 028@SuppressWarnings({ "PMD.TooManyMethods", "PMD.ExcessivePublicCount" }) 029public class Fwd2OsgiLogger extends MarkerIgnoringBase implements LoggerFacade { 030 private static final long serialVersionUID = -6844449574931434059L; 031 032 private final LoggerGroup group; 033 private final String name; 034 @SuppressWarnings("PMD.LoggerIsNotStaticFinal") 035 private org.osgi.service.log.Logger delegee; 036 037 /** 038 * Instantiates a new logger with the provided name. 039 * 040 * @param group the group that the logger belongs to 041 * @param name the name 042 */ 043 public Fwd2OsgiLogger(LoggerGroup group, String name) { 044 this.group = group; 045 this.name = name; 046 LoggerFacadeManager.registerFacade(this); 047 } 048 049 @Override 050 public void loggerFactoryUpdated(LoggerFactory factory) { 051 delegee = factory.getLogger(group.getBundle(), name, 052 org.osgi.service.log.Logger.class); 053 } 054 055 @Override 056 public boolean isTraceEnabled() { 057 return delegee.isTraceEnabled(); 058 } 059 060 @Override 061 public void trace(String format, Object arg1, Object arg2) { 062 delegee.trace(format, arg1, arg2); 063 } 064 065 @Override 066 public void trace(String format, Object... arguments) { 067 delegee.trace(format, arguments); 068 } 069 070 @Override 071 public void trace(String format, Object arg) { 072 delegee.trace(format, arg); 073 } 074 075 @Override 076 public void trace(String message, Throwable arg) { 077 delegee.trace(message, arg); 078 } 079 080 @Override 081 public void trace(String message) { 082 delegee.trace(message); 083 } 084 085 @Override 086 public boolean isDebugEnabled() { 087 return delegee.isDebugEnabled(); 088 } 089 090 @Override 091 public void debug(String format, Object arg1, Object arg2) { 092 delegee.debug(format, arg1, arg2); 093 } 094 095 @Override 096 public void debug(String format, Object... arguments) { 097 delegee.debug(format, arguments); 098 } 099 100 @Override 101 public void debug(String format, Object arg) { 102 delegee.debug(format, arg); 103 } 104 105 @Override 106 public void debug(String message, Throwable arg1) { 107 delegee.debug(message, arg1); 108 } 109 110 @Override 111 public void debug(String message) { 112 delegee.debug(message); 113 } 114 115 @Override 116 public boolean isInfoEnabled() { 117 return delegee.isInfoEnabled(); 118 } 119 120 @Override 121 public void info(String format, Object arg1, Object arg2) { 122 delegee.info(format, arg1, arg2); 123 } 124 125 @Override 126 public void info(String format, Object... arguments) { 127 delegee.info(format, arguments); 128 } 129 130 @Override 131 public void info(String format, Object arg) { 132 delegee.info(format, arg); 133 } 134 135 @Override 136 public void info(String message, Throwable arg1) { 137 delegee.info(message, arg1); 138 } 139 140 @Override 141 public void info(String message) { 142 delegee.info(message); 143 } 144 145 @Override 146 public boolean isWarnEnabled() { 147 return delegee.isWarnEnabled(); 148 } 149 150 @Override 151 public void warn(String format, Object arg1, Object arg2) { 152 delegee.warn(format, arg1, arg2); 153 } 154 155 @Override 156 public void warn(String format, Object... arg1) { 157 delegee.warn(format, arg1); 158 } 159 160 @Override 161 public void warn(String format, Object arg) { 162 delegee.warn(format, arg); 163 } 164 165 @Override 166 public void warn(String message, Throwable arg1) { 167 delegee.warn(message, arg1); 168 } 169 170 @Override 171 public void warn(String message) { 172 delegee.warn(message); 173 } 174 175 @Override 176 public boolean isErrorEnabled() { 177 return delegee.isErrorEnabled(); 178 } 179 180 @Override 181 public void error(String format, Object arg1, Object arg2) { 182 delegee.error(format, arg1, arg2); 183 } 184 185 @Override 186 public void error(String format, Object... arguments) { 187 delegee.error(format, arguments); 188 } 189 190 @Override 191 public void error(String format, Object arg) { 192 delegee.error(format, arg); 193 } 194 195 @Override 196 public void error(String message, Throwable arg1) { 197 delegee.error(message, arg1); 198 } 199 200 @Override 201 public void error(String message) { 202 delegee.error(message); 203 } 204 205}