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

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

本文整理了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

  1. @Override
  2. public String toString() {
  3. return Logger.format(
  4. "[%d:%d] \"%s\", \"%s\", \"%s\", \"%s\"",
  5. this.iline,
  6. this.icolumn,
  7. this.isource,
  8. this.iexplanation,
  9. this.msg,
  10. this.imessage
  11. );
  12. }

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

  1. /**
  2. * Asserts that an object is not <code>null</code> and throws
  3. * IllegalStateException if the object is <code>null</code>.
  4. * @param object The object to check
  5. * @param message The exception message to use if the assertion fails
  6. * @since 0.12
  7. */
  8. private void assertNotNull(final Object object, final String message) {
  9. if (object == null) {
  10. throw new IllegalStateException(Logger.format(message, this));
  11. }
  12. }
  13. }

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

  1. @Override
  2. public void describeTo(final Description description) {
  3. description.appendText(
  4. Logger.format(
  5. "%d broken link(s) found: %[list]s",
  6. this.broken.size(),
  7. this.broken
  8. )
  9. );
  10. }

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

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

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

  1. @Override
  2. public String toString() {
  3. return new StringBuilder(0)
  4. .append(Logger.format("Validity: %B\n", this.ivalid))
  5. .append(Logger.format("Validator: \"%s\"\n", this.validator))
  6. .append(Logger.format("DOCTYPE: \"%s\"\n", this.type))
  7. .append(Logger.format("Charset: \"%s\"\n", this.encoding))
  8. .append("Errors:\n")
  9. .append(DefaultValidationResponse.asText(this.ierrors))
  10. .append("Warnings:\n")
  11. .append(DefaultValidationResponse.asText(this.iwarnings))
  12. .toString();
  13. }

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

  1. @Override
  2. public String body() {
  3. final String body = new String(this.content, DefaultResponse.CHARSET);
  4. if (body.contains(DefaultResponse.ERR)) {
  5. throw new IllegalStateException(
  6. Logger.format(
  7. "broken Unicode text at line #%d in '%[text]s' (%d bytes)",
  8. body.length() - body.replace("\n", "").length(),
  9. body,
  10. this.content.length
  11. )
  12. );
  13. }
  14. return body;
  15. }

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

  1. @Override
  2. @NotNull
  3. public String render(@NotNull final String defect) {
  4. Logger.warn(this, "#render(..): %s", this.message);
  5. return Logger.format(
  6. "<html><body><pre>%s\n\n%s</pre></body></html>",
  7. this.message,
  8. defect
  9. );
  10. }
  11. }

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

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

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

  1. @Override
  2. public String toString() {
  3. return Logger.format(
  4. ".htpasswd(%d user(s), reloaded every %d min)",
  5. this.fetch().size(),
  6. Htpasswd.LIFETIME
  7. );
  8. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Get namespaces as map.
  3. * @param namespaces The namespaces
  4. * @return Namespaces as map
  5. */
  6. private static ArrayMap<String, String> namespacesAsMap(
  7. final Object...namespaces) {
  8. final ConcurrentMap<String, String> map =
  9. new ConcurrentHashMap<>(namespaces.length);
  10. for (int pos = 0; pos < namespaces.length; ++pos) {
  11. map.put(
  12. Logger.format("ns%d", pos + 1),
  13. namespaces[pos].toString()
  14. );
  15. }
  16. return new ArrayMap<>(map);
  17. }

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

  1. @Override
  2. public String get(final String key) {
  3. final String slot = this.slots.get(key);
  4. if (slot == null) {
  5. throw new IllegalArgumentException(
  6. Logger.format(
  7. "slot '%s' not found among %[list]s",
  8. key, this.slots.keySet()
  9. )
  10. );
  11. }
  12. return slot;
  13. }
  14. @Override

相关文章