Class Logging.WriteOption (3.15.17)

public static final class Logging.WriteOption extends Option

Class for specifying options for writing log entries.

Inheritance

Object > com.google.cloud.logging.Option > Logging.WriteOption

Static Methods

autoPopulateMetadata(boolean autoPopulateMetadata)

public static Logging.WriteOption autoPopulateMetadata(boolean autoPopulateMetadata)

Returns an option to opt-out automatic population of log entries metadata fields that are not set.

Parameter
NameDescription
autoPopulateMetadataboolean
Returns
TypeDescription
Logging.WriteOption

destination(LogDestinationName destination)

public static Logging.WriteOption destination(LogDestinationName destination)

Returns an option to specify a log destination resource path (see LogDestinationName for details)

Parameter
NameDescription
destinationLogDestinationName
Returns
TypeDescription
Logging.WriteOption

labels(Map<String,String> labels)

public static Logging.WriteOption labels(Map<String,String> labels)

Sets an option to specify (key, value) pairs that are added to the LogEntry#getLabels() of each log entry written, except when a log entry already has a value associated to the same key.

Parameter
NameDescription
labelsMap<String,String>
Returns
TypeDescription
Logging.WriteOption

logName(String logName)

public static Logging.WriteOption logName(String logName)

Returns an option to specify a default log name (see LogEntry#getLogName()) for those log entries that do not specify their own log name. Example: syslog.

Parameter
NameDescription
logNameString
Returns
TypeDescription
Logging.WriteOption

partialSuccess(boolean partialSuccess)

public static Logging.WriteOption partialSuccess(boolean partialSuccess)

Returns an option to set partialSuccess flag. See the API documentation for more details.

Parameter
NameDescription
partialSuccessboolean
Returns
TypeDescription
Logging.WriteOption

resource(MonitoredResource resource)

public static Logging.WriteOption resource(MonitoredResource resource)

Returns an option to specify a default monitored resource (see LogEntry#getResource()) for those log entries that do not specify their own resource.

Parameter
NameDescription
resourcecom.google.cloud.MonitoredResource
Returns
TypeDescription
Logging.WriteOption