com.jcabi.log.Logger.format()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中com.jcabi.log.Logger.format()方法的一些代码示例,展示了Logger.format()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.format()方法的具体详情如下:
包路径:com.jcabi.log.Logger
类名称:Logger
方法名:format

Logger.format介绍

[英]Format one string.
[中]格式化一个字符串。

代码示例

代码示例来源:origin: com.jcabi/jcabi-w3c

@Override
public String toString() {
  return Logger.format(
    "[%d:%d] \"%s\", \"%s\", \"%s\", \"%s\"",
    this.iline,
    this.icolumn,
    this.isource,
    this.iexplanation,
    this.msg,
    this.imessage
  );
}

代码示例来源:origin: com.rexsl/rexsl

/**
   * Asserts that an object is not <code>null</code> and throws
   * IllegalStateException if the object is <code>null</code>.
   * @param object The object to check
   * @param message The exception message to use if the assertion fails
   * @since 0.12
   */
  private void assertNotNull(final Object object, final String message) {
    if (object == null) {
      throw new IllegalStateException(Logger.format(message, this));
    }
  }
}

代码示例来源:origin: com.rexsl/rexsl-test

@Override
public void describeTo(final Description description) {
  description.appendText(
    Logger.format(
      "%d broken link(s) found: %[list]s",
      this.broken.size(),
      this.broken
    )
  );
}

代码示例来源:origin: com.rexsl/rexsl

@Override
@NotNull
public String getFilterName() {
  return Logger.format("%s-filter", this.config.getServletName());
}

代码示例来源:origin: com.jcabi/jcabi-w3c

@Override
public String toString() {
  return new StringBuilder(0)
    .append(Logger.format("Validity: %B\n", this.ivalid))
    .append(Logger.format("Validator: \"%s\"\n", this.validator))
    .append(Logger.format("DOCTYPE: \"%s\"\n", this.type))
    .append(Logger.format("Charset: \"%s\"\n", this.encoding))
    .append("Errors:\n")
    .append(DefaultValidationResponse.asText(this.ierrors))
    .append("Warnings:\n")
    .append(DefaultValidationResponse.asText(this.iwarnings))
    .toString();
}

代码示例来源:origin: jcabi/jcabi-http

@Override
public String body() {
  final String body = new String(this.content, DefaultResponse.CHARSET);
  if (body.contains(DefaultResponse.ERR)) {
    throw new IllegalStateException(
      Logger.format(
        "broken Unicode text at line #%d in '%[text]s' (%d bytes)",
        body.length() - body.replace("\n", "").length(),
        body,
        this.content.length
      )
    );
  }
  return body;
}

代码示例来源:origin: com.rexsl/rexsl

@Override
  @NotNull
  public String render(@NotNull final String defect) {
    Logger.warn(this, "#render(..): %s", this.message);
    return Logger.format(
      "<html><body><pre>%s\n\n%s</pre></body></html>",
      this.message,
      defect
    );
  }
}

代码示例来源:origin: com.jcabi/jcabi-log

/**
 * Protocol one message, with {@code ERROR} priority level.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void error(final Object source,
  final String msg, final Object... args) {
  Logger.logger(source).error(Logger.format(msg, args));
}

代码示例来源:origin: yegor256/s3auth

@Override
public String toString() {
  return Logger.format(
    ".htpasswd(%d user(s), reloaded every %d min)",
    this.fetch().size(),
    Htpasswd.LIFETIME
  );
}

代码示例来源:origin: com.jcabi/jcabi-log

/**
 * Protocol one message, with {@code DEBUG} priority level
 * without internal checking whether {@code DEBUG} level is enabled.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void debugForced(
  final Object source,
  final String msg, final Object... args
) {
  Logger.logger(source).debug(Logger.format(msg, args));
}

代码示例来源:origin: com.jcabi/jcabi-log

/**
 * Protocol one message, with {@code TRACE} priority level
 * without internal checking whether {@code TRACE} level is enabled.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void traceForced(
  final Object source,
  final String msg, final Object... args
) {
  Logger.logger(source).trace(Logger.format(msg, args));
}

代码示例来源:origin: com.jcabi/jcabi-log

/**
 * Protocol one message, with {@code INFO} priority level
 * without internal checking whether {@code INFO} level is enabled.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void infoForced(
  final Object source, final String msg,
  final Object... args
) {
  Logger.logger(source).info(Logger.format(msg, args));
}

代码示例来源:origin: jcabi/jcabi-log

/**
 * Protocol one message, with {@code INFO} priority level
 * without internal checking whether {@code INFO} level is enabled.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void infoForced(
  final Object source, final String msg,
  final Object... args
) {
  Logger.logger(source).info(Logger.format(msg, args));
}

代码示例来源:origin: jcabi/jcabi-log

/**
 * Protocol one message, with {@code WARN} priority level
 * without internal checking whether {@code WARN} level is enabled.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void warnForced(
  final Object source,
  final String msg, final Object... args
) {
  Logger.logger(source).warn(Logger.format(msg, args));
}

代码示例来源:origin: jcabi/jcabi-log

/**
 * Protocol one message, with {@code ERROR} priority level.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void error(final Object source,
  final String msg, final Object... args) {
  Logger.logger(source).error(Logger.format(msg, args));
}

代码示例来源:origin: jcabi/jcabi-log

/**
 * Protocol one message, with {@code TRACE} priority level
 * without internal checking whether {@code TRACE} level is enabled.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void traceForced(
  final Object source,
  final String msg, final Object... args
) {
  Logger.logger(source).trace(Logger.format(msg, args));
}

代码示例来源:origin: jcabi/jcabi-log

/**
 * Protocol one message, with {@code DEBUG} priority level
 * without internal checking whether {@code DEBUG} level is enabled.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void debugForced(
  final Object source,
  final String msg, final Object... args
) {
  Logger.logger(source).debug(Logger.format(msg, args));
}

代码示例来源:origin: com.jcabi/jcabi-log

/**
 * Protocol one message, with {@code WARN} priority level
 * without internal checking whether {@code WARN} level is enabled.
 * @param source The source of the logging operation
 * @param msg The text message to be logged, with meta-tags
 * @param args List of arguments
 */
public static void warnForced(
  final Object source,
  final String msg, final Object... args
) {
  Logger.logger(source).warn(Logger.format(msg, args));
}

代码示例来源:origin: com.jcabi/jcabi-xml

/**
 * Get namespaces as map.
 * @param namespaces The namespaces
 * @return Namespaces as map
 */
private static ArrayMap<String, String> namespacesAsMap(
  final Object...namespaces) {
  final ConcurrentMap<String, String> map =
    new ConcurrentHashMap<>(namespaces.length);
  for (int pos = 0; pos < namespaces.length; ++pos) {
    map.put(
      Logger.format("ns%d", pos + 1),
      namespaces[pos].toString()
    );
  }
  return new ArrayMap<>(map);
}

代码示例来源:origin: com.rempl/rempl

@Override
public String get(final String key) {
  final String slot = this.slots.get(key);
  if (slot == null) {
    throw new IllegalArgumentException(
      Logger.format(
        "slot '%s' not found among %[list]s",
        key, this.slots.keySet()
      )
    );
  }
  return slot;
}
@Override

相关文章