/// <summary> /// Create an <see cref="ILoggerProvider"/> for Google Stackdriver Logging. /// </summary> /// <param name="logTarget">Where to log to. Cannot be null.</param> /// <param name="options">Optional, options for the logger.</param> /// <param name="client">Optional, logging client.</param> public static GoogleLoggerProvider Create(LogTarget logTarget, LoggerOptions options = null, LoggingServiceV2Client client = null) { // Check params and set defaults if unset. GaxPreconditions.CheckNotNull(logTarget, nameof(logTarget)); client = client ?? LoggingServiceV2Client.Create(); options = options ?? LoggerOptions.Create(); // Get the proper consumer from the options and add a logger provider. IConsumer <LogEntry> consumer = LogConsumer.Create(client, options.BufferOptions, options.RetryOptions); return(new GoogleLoggerProvider(consumer, logTarget, options)); }