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.checker;
019
020import org.apache.maven.plugin.logging.Log;
021import org.slf4j.helpers.MessageFormatter;
022
023/**
024 * @author Andres Almiray
025 * @since 1.1.0
026 */
027public class MavenLoggerAdapter implements Logger {
028    private final Log delegate;
029
030    public MavenLoggerAdapter(Log delegate) {
031        this.delegate = delegate;
032    }
033
034    @Override
035    public void debug(String message) {
036        delegate.debug(message);
037    }
038
039    @Override
040    public void info(String message) {
041        delegate.info(message);
042    }
043
044    @Override
045    public void warn(String message) {
046        delegate.warn(message);
047    }
048
049    @Override
050    public void error(String message) {
051        delegate.error(message);
052    }
053
054    @Override
055    public void debug(String message, Object... args) {
056        delegate.debug(MessageFormatter.arrayFormat(message, args).getMessage());
057    }
058
059    @Override
060    public void info(String message, Object... args) {
061        delegate.info(MessageFormatter.arrayFormat(message, args).getMessage());
062    }
063
064    @Override
065    public void warn(String message, Object... args) {
066        delegate.warn(MessageFormatter.arrayFormat(message, args).getMessage());
067    }
068
069    @Override
070    public void error(String message, Object... args) {
071        delegate.error(MessageFormatter.arrayFormat(message, args).getMessage());
072    }
073
074    @Override
075    public void debug(String message, Throwable throwable) {
076        delegate.debug(message, throwable);
077    }
078
079    @Override
080    public void info(String message, Throwable throwable) {
081        delegate.info(message, throwable);
082    }
083
084    @Override
085    public void warn(String message, Throwable throwable) {
086        delegate.warn(message, throwable);
087    }
088
089    @Override
090    public void error(String message, Throwable throwable) {
091        delegate.error(message, throwable);
092    }
093}