001/* 002 * SPDX-License-Identifier: Apache-2.0 003 * 004 * Copyright 2020-2024 Andres Almiray. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.kordamp.maven.enforcer.checker; 019 020import org.apache.maven.enforcer.rule.api.EnforcerLogger; 021import org.kordamp.maven.checker.Logger; 022import org.slf4j.helpers.MessageFormatter; 023 024/** 025 * @author Andres Almiray 026 * @since 1.9.0 027 */ 028public class MavenEnforcerLoggerAdapter implements Logger { 029 private final EnforcerLogger delegate; 030 031 public MavenEnforcerLoggerAdapter(EnforcerLogger delegate) { 032 this.delegate = delegate; 033 } 034 035 @Override 036 public void debug(String message) { 037 delegate.debug(message); 038 } 039 040 @Override 041 public void info(String message) { 042 delegate.info(message); 043 } 044 045 @Override 046 public void warn(String message) { 047 delegate.warn(message); 048 } 049 050 @Override 051 public void error(String message) { 052 delegate.error(message); 053 } 054 055 @Override 056 public void debug(String message, Object... args) { 057 delegate.debug(MessageFormatter.arrayFormat(message, args).getMessage()); 058 } 059 060 @Override 061 public void info(String message, Object... args) { 062 delegate.info(MessageFormatter.arrayFormat(message, args).getMessage()); 063 } 064 065 @Override 066 public void warn(String message, Object... args) { 067 delegate.warn(MessageFormatter.arrayFormat(message, args).getMessage()); 068 } 069 070 @Override 071 public void error(String message, Object... args) { 072 delegate.error(MessageFormatter.arrayFormat(message, args).getMessage()); 073 } 074 075 @Override 076 public void debug(String message, Throwable throwable) { 077 delegate.debug(message + " " + throwable); 078 } 079 080 @Override 081 public void info(String message, Throwable throwable) { 082 delegate.info(message + " " + throwable); 083 } 084 085 @Override 086 public void warn(String message, Throwable throwable) { 087 delegate.warn(message + " " + throwable); 088 } 089 090 @Override 091 public void error(String message, Throwable throwable) { 092 delegate.error(message + " " + throwable); 093 } 094}