Java slf4j Logger format(String format, Object... args)

Here you can find the source of format(String format, Object... args)

Description

Returns a formatted string using SLF4J-style argument place holders.

License

Open Source License

Parameter

Parameter Description
format The string format
args The optional arguments to replace in the format

Return

the formatted string.

Declaration

public static String format(String format, Object... args) 

Method Source Code


//package com.java2s;
/*//from ww w .  j  a v  a  2 s . co m
 * Copyright (C) 2015 CapTech Ventures, Inc.
 * (http://www.captechconsulting.com) All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.slf4j.helpers.MessageFormatter;

public class Main {
    /**
     * Returns a formatted string using SLF4J-style argument place holders.
     * 
     * @param format
     *            The string format
     * @param args
     *            The optional arguments to replace in the format
     * @return the formatted string.
     */
    public static String format(String format, Object... args) {
        return MessageFormatter.arrayFormat(format, args).getMessage();
    }
}

Related

  1. error(String msg, Throwable e)
  2. ExecptionLog(Logger log, String msg, Throwable e)
  3. extractValue(String var)
  4. findMarker(Marker marker, String name)
  5. format(final String pattern, final @Nullable Object... arguments)
  6. format(String messagePattern, Object... args)
  7. get(Class clazz)
  8. getClassLogger()
  9. getErrorMsg(String format, Object[] argArray)