src/java.net.http/share/classes/jdk/internal/net/http/common/Logger.java
author dfuchs
Fri, 13 Apr 2018 16:14:15 +0100
branchhttp-client-branch
changeset 56429 d61066f546a7
child 56437 f8b3f053cfbb
permissions -rw-r--r--
http-client-branch: review comment - provide a logger that can be protected with assert
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56429
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     1
/*
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     4
 *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    10
 *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    15
 * accompanied this code).
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    16
 *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    20
 *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    23
 * questions.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    24
 */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    25
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    26
package jdk.internal.net.http.common;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    27
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    28
import java.util.Objects;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    29
import java.util.ResourceBundle;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    30
import java.util.function.Supplier;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    31
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    32
/**
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    33
 * An internal {@code System.Logger} that is used for internal
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    34
 * debugging purposes in the {@link java.net.http} module.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    35
 * <p>
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    36
 * Though not enforced, this interface is designed for emitting
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    37
 * debug messages with Level.DEBUG, when system assertions are
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    38
 * turned on.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    39
 * <p>
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    40
 * It defines {@code log} methods that default to {@code Level.DEBUG}
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    41
 * and always return {@code true}, so that they can be called in
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    42
 * assert statements like:
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    43
 * <pre>{@code assert debug.log("some %s with %d %s", message(), one(), params());}</pre>
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    44
 *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    45
 * @implSpec
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    46
 * This interface is implemented by loggers returned by
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    47
 * {@link Utils#getDebugLogger(Supplier, boolean)},
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    48
 * {@link Utils#getWebSocketLogger(Supplier, boolean)}and
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    49
 * {@link Utils#getHpackLogger(Supplier, boolean)}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    50
 * It is not designed to be implemented by any other
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    51
 * loggers. Do not use outside of this module.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    52
 */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    53
public interface Logger extends System.Logger {
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    54
    /**
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    55
     * Tells whether this logger is on.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    56
     * @implSpec The default implementation for this method calls
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    57
     * {@code this.isLoggable(Level.DEBUG);}
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    58
     */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    59
    public default boolean isOn() {
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    60
        return isLoggable(Level.DEBUG);
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    61
    }
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    62
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    63
    /**
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    64
     * Logs a message.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    65
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    66
     * @implSpec The default implementation for this method calls
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    67
     * {@code this.log(Level.DEBUG, msg);}
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    68
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    69
     * @param msg the string message (or a key in the message catalog, if
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    70
     * this logger is a {@link
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    71
     * System.LoggerFinder#getLocalizedLogger(java.lang.String,
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    72
     * java.util.ResourceBundle, java.lang.Module) localized logger});
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    73
     * can be {@code null}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    74
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    75
     * @return Always return true.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    76
     */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    77
    public default boolean log(String msg) {
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    78
        log(Level.DEBUG, msg);
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    79
        return true;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    80
    }
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    81
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    82
    /**
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    83
     * Logs a lazily supplied message.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    84
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    85
     * @implSpec The default implementation for this method calls
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    86
     * {@code this.log(Level.DEBUG, msgSupplier);}
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    87
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    88
     * @param msgSupplier a supplier function that produces a message.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    89
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    90
     * @throws NullPointerException if {@code msgSupplier} is {@code null}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    91
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    92
     * @return Always return true.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    93
     */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    94
    public default boolean log(Supplier<String> msgSupplier) {
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    95
        log(Level.DEBUG, msgSupplier);
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    96
        return true;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    97
    }
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    98
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
    99
    /**
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   100
     * Logs a message produced from the given object.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   101
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   102
     * @implSpec The default implementation for this method calls
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   103
     * {@code this.log(Level.DEBUG, obj);}
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   104
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   105
     * @param obj the object to log.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   106
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   107
     * @throws NullPointerException if {@code obj} is {@code null}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   108
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   109
     * @return Always return true.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   110
     */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   111
    public default boolean log(Object obj) {
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   112
        log(Level.DEBUG,  obj);
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   113
        return true;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   114
    }
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   115
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   116
    /**
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   117
     * Logs a message associated with a given throwable.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   118
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   119
     * @implSpec The default implementation for this method calls
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   120
     * {@code this.log(Level.DEBUG, msg, thrown);}
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   121
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   122
     * @param msg the string message (or a key in the message catalog, if
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   123
     * this logger is a {@link
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   124
     * System.LoggerFinder#getLocalizedLogger(java.lang.String,
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   125
     * java.util.ResourceBundle, java.lang.Module) localized logger});
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   126
     * can be {@code null}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   127
     * @param thrown a {@code Throwable} associated with the log message;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   128
     *        can be {@code null}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   129
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   130
     * @return Always return true.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   131
     */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   132
    public default boolean log(String msg, Throwable thrown) {
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   133
        this.log(Level.DEBUG, msg, thrown);
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   134
        return true;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   135
    }
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   136
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   137
    /**
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   138
     * Logs a lazily supplied message associated with a given throwable.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   139
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   140
     * @implSpec The default implementation for this method calls
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   141
     * {@code this.log(Level.DEBUG, msgSupplier, thrown);}
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   142
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   143
     * @param msgSupplier a supplier function that produces a message.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   144
     * @param thrown a {@code Throwable} associated with log message;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   145
     *               can be {@code null}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   146
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   147
     * @throws NullPointerException if {@code msgSupplier} is {@code null}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   148
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   149
     * @return Always return true.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   150
     */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   151
    public default boolean log(Supplier<String> msgSupplier, Throwable thrown) {
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   152
        log(Level.DEBUG, msgSupplier, thrown);
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   153
        return true;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   154
    }
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   155
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   156
    /**
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   157
     * Logs a message with an optional list of parameters.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   158
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   159
     * @implSpec The default implementation for this method calls
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   160
     * {@code this.log(Level.DEBUG, format, params);}
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   161
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   162
     * @param format the string message format in
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   163
     * {@link String#format(String, Object...)} or {@link
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   164
     * java.text.MessageFormat} format, (or a key in the message
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   165
     * catalog, if this logger is a {@link
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   166
     * System.LoggerFinder#getLocalizedLogger(java.lang.String,
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   167
     * java.util.ResourceBundle, java.lang.Module) localized logger});
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   168
     * can be {@code null}.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   169
     * @param params an optional list of parameters to the message (may be
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   170
     * none).
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   171
     *
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   172
     * @return Always return true.
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   173
     */
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   174
    public default boolean log(String format, Object... params) {
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   175
        log(Level.DEBUG, format, params);
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   176
        return true;
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   177
    }
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   178
d61066f546a7 http-client-branch: review comment - provide a logger that can be protected with assert
dfuchs
parents:
diff changeset
   179
}