blob: c718080a3938c2fa15ecddc410854ef00de309d8 [file] [log] [blame]
Matthias Andreas Benkardb8fbc372021-05-11 06:50:45 +02001package eu.mulk.quarkus.googlecloud.jsonlogging;
2
3import javax.json.JsonObjectBuilder;
4
Matthias Andreas Benkard692f48d2021-08-31 21:06:50 +02005/**
6 * A structured parameter usable as logging payload.
7 *
8 * <p>Any instance of {@link StructuredParameter} can be passed as a log parameter to the {@code *f}
9 * family of logging functions on {@link org.jboss.logging.Logger}.
10 *
11 * <p>Example:
12 *
13 * <pre>{@code
14 * StructuredParameter p1 = ...;
15 * StructuredParameter p2 = ...;
16 *
17 * logger.logf("Something interesting happened.", p1, p2);
18 * }</pre>
19 *
20 * @see KeyValueParameter
21 * @see Label
22 */
Matthias Andreas Benkardb8fbc372021-05-11 06:50:45 +020023public interface StructuredParameter {
Matthias Andreas Benkard692f48d2021-08-31 21:06:50 +020024
25 /**
Matthias Andreas Benkard42da9f12021-09-02 18:47:28 +020026 * The JSON to be embedded in the payload of the log entry.
Matthias Andreas Benkard692f48d2021-08-31 21:06:50 +020027 *
28 * <p>May contain multiple keys and values as well as nested objects. Each top-level entry of the
Matthias Andreas Benkard42da9f12021-09-02 18:47:28 +020029 * returned object is embedded as a top-level entry in the payload of the log entry.
30 *
31 * @return A {@link JsonObjectBuilder} holding a set of key–value pairs.
Matthias Andreas Benkard692f48d2021-08-31 21:06:50 +020032 */
Matthias Andreas Benkardb8fbc372021-05-11 06:50:45 +020033 JsonObjectBuilder json();
34}