azure-docs-sdk-java/docs-ref-autogen/com.azure.core.util.logging...

193 строки
15 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.util.logging.LoggingEventBuilder"
fullName: "com.azure.core.util.logging.LoggingEventBuilder"
name: "LoggingEventBuilder"
nameWithType: "LoggingEventBuilder"
summary: "This class provides fluent API to write logs using <xref uid=\"com.azure.core.util.logging.ClientLogger\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ClientLogger\"></xref> and enrich them with additional context."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **LoggingEventBuilder**"
methods:
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,boolean)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, boolean value)"
name: "addKeyValue(String key, boolean value)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, boolean value)"
summary: "Adds key with boolean value to the context of current log being created."
parameters:
- description: "String key."
name: "key"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "boolean value."
name: "value"
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
syntax: "public LoggingEventBuilder addKeyValue(String key, boolean value)"
desc: "Adds key with boolean value to the context of current log being created."
returns:
description: "The updated <code>LoggingEventBuilder</code> object."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,java.lang.Object)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, Object value)"
name: "addKeyValue(String key, Object value)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, Object value)"
summary: "Adds key with Object value to the context of current log being created."
parameters:
- description: "String key."
name: "key"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Object value."
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
syntax: "public LoggingEventBuilder addKeyValue(String key, Object value)"
desc: "Adds key with Object value to the context of current log being created. If logging is enabled at given level, and object is not null, uses `value.toString()` to serialize object.\n\n**Code samples**\n\nAdding string value to logging event context.\n\n```java\nlogger.atVerbose()\n // equivalent to addKeyValue(\"key\", () -> new LoggableObject(\"string representation\").toString()\n .addKeyValue(\"key\", new LoggableObject(\"string representation\"))\n .log(\"Param 1: {}, Param 2: {}, Param 3: {}\", \"param1\", \"param2\", \"param3\");\n```"
returns:
description: "The updated <code>LoggingEventBuilder</code> object."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,java.lang.String)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, String value)"
name: "addKeyValue(String key, String value)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, String value)"
summary: "Adds key with String value pair to the context of current log being created."
parameters:
- description: "String key."
name: "key"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "String value."
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public LoggingEventBuilder addKeyValue(String key, String value)"
desc: "Adds key with String value pair to the context of current log being created.\n\n**Code samples**\n\nAdding string value to logging event context.\n\n```java\nlogger.atInfo()\n .addKeyValue(\"key\", \"value\")\n .log(\"A formattable message. Hello, {}\", name);\n```"
returns:
description: "The updated <code>LoggingEventBuilder</code> object."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,java.util.function.Supplier<java.lang.String>)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, Supplier<String> valueSupplier)"
name: "addKeyValue(String key, Supplier<String> valueSupplier)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, Supplier<String> valueSupplier)"
summary: "Adds key with String value supplier to the context of current log event being created."
parameters:
- description: "String key."
name: "key"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "String value supplier function."
name: "valueSupplier"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html\">Supplier</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
syntax: "public LoggingEventBuilder addKeyValue(String key, Supplier<String> valueSupplier)"
desc: "Adds key with String value supplier to the context of current log event being created."
returns:
description: "The updated <code>LoggingEventBuilder</code> object."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(java.lang.String,long)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.addKeyValue(String key, long value)"
name: "addKeyValue(String key, long value)"
nameWithType: "LoggingEventBuilder.addKeyValue(String key, long value)"
summary: "Adds key with long value to the context of current log event being created."
parameters:
- description: "String key."
name: "key"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "long value."
name: "value"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public LoggingEventBuilder addKeyValue(String key, long value)"
desc: "Adds key with long value to the context of current log event being created.\n\n**Code samples**\n\nAdding an integer value to logging event context.\n\n```java\nlogger.atVerbose()\n .addKeyValue(\"key\", 1L)\n .log(() -> String.format(\"Param 1: %s, Param 2: %s, Param 3: %s\", \"param1\", \"param2\", \"param3\"));\n```"
returns:
description: "The updated <code>LoggingEventBuilder</code> object."
type: "<xref href=\"com.azure.core.util.logging.LoggingEventBuilder?alt=com.azure.core.util.logging.LoggingEventBuilder&text=LoggingEventBuilder\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.lang.RuntimeException)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(RuntimeException runtimeException)"
name: "log(RuntimeException runtimeException)"
nameWithType: "LoggingEventBuilder.log(RuntimeException runtimeException)"
summary: "Logs the <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> and returns it to be thrown."
parameters:
- description: "RuntimeException to be logged and returned."
name: "runtimeException"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/RuntimeException.html\">RuntimeException</a>"
syntax: "public RuntimeException log(RuntimeException runtimeException)"
desc: "Logs the <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref> and returns it to be thrown. This API covers the cases where a checked exception type needs to be thrown and logged."
returns:
description: "The passed <xref uid=\"java.lang.RuntimeException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RuntimeException\"></xref>."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/RuntimeException.html\">RuntimeException</a>"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.lang.String)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(String message)"
name: "log(String message)"
nameWithType: "LoggingEventBuilder.log(String message)"
summary: "Logs message annotated with context."
parameters:
- description: "the message to log."
name: "message"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public void log(String message)"
desc: "Logs message annotated with context."
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.lang.String,java.lang.Object...)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(String format, Object[] args)"
name: "log(String format, Object[] args)"
nameWithType: "LoggingEventBuilder.log(String format, Object[] args)"
summary: "Logs a format-able message that uses `{}` as the placeholder at `warning` log level."
parameters:
- description: "The format-able message to log."
name: "format"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Arguments for the message. If an exception is being logged, the last argument should be the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
name: "args"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>[]"
syntax: "public void log(String format, Object[] args)"
desc: "Logs a format-able message that uses `{}` as the placeholder at `warning` log level."
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.lang.Throwable)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(Throwable throwable)"
name: "log(Throwable throwable)"
nameWithType: "LoggingEventBuilder.log(Throwable throwable)"
summary: "Logs the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> and returns it to be thrown."
parameters:
- description: "Throwable to be logged and returned."
name: "throwable"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html\">Throwable</a>"
syntax: "public Throwable log(Throwable throwable)"
desc: "Logs the <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> and returns it to be thrown."
returns:
description: "The passed <xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref>."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html\">Throwable</a>"
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.util.function.Supplier<java.lang.String>)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(Supplier<String> messageSupplier)"
name: "log(Supplier<String> messageSupplier)"
nameWithType: "LoggingEventBuilder.log(Supplier<String> messageSupplier)"
summary: "Logs message annotated with context."
parameters:
- description: "string message supplier."
name: "messageSupplier"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html\">Supplier</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
syntax: "public void log(Supplier<String> messageSupplier)"
desc: "Logs message annotated with context."
- uid: "com.azure.core.util.logging.LoggingEventBuilder.log(java.util.function.Supplier<java.lang.String>,java.lang.Throwable)"
fullName: "com.azure.core.util.logging.LoggingEventBuilder.log(Supplier<String> messageSupplier, Throwable throwable)"
name: "log(Supplier<String> messageSupplier, Throwable throwable)"
nameWithType: "LoggingEventBuilder.log(Supplier<String> messageSupplier, Throwable throwable)"
summary: "Logs message annotated with context."
parameters:
- description: "string message supplier."
name: "messageSupplier"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html\">Supplier</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
- description: "<xref uid=\"java.lang.Throwable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Throwable\"></xref> for the message."
name: "throwable"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html\">Throwable</a>"
syntax: "public void log(Supplier<String> messageSupplier, Throwable throwable)"
desc: "Logs message annotated with context."
type: "class"
desc: "This class provides fluent API to write logs using <xref uid=\"com.azure.core.util.logging.ClientLogger\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ClientLogger\"></xref> and enrich them with additional context.\n\n**Code samples**\n\nLogging event with context.\n\n```java\nlogger.atInfo()\n .addKeyValue(\"key1\", \"value1\")\n .addKeyValue(\"key2\", true)\n .addKeyValue(\"key3\", () -> getName())\n .log(\"A formattable message. Hello, {}\", name);\n```"
metadata: {}
package: "com.azure.core.util.logging"
artifact: com.azure:azure-core:1.52.0