Interface LogClient

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
BatchingLogClient

public interface LogClient extends AutoCloseable
Sends log records to the service in the background. Implemented by BatchingLogClient.
  • Method Details

    • send

      void send(LogEntry entry)
      Enqueues one record or input. Applies redaction and defaults (timestamp = now, resource from the client, trace correlation for inputs when a span is active). Never throws for a full queue or a closed client; the record is dropped and counted instead.
      Parameters:
      entry - a LogRecord or LogInput
    • sendBatch

      void sendBatch(Collection<? extends LogEntry> entries)
      Enqueues several records or inputs.
      Parameters:
      entries - records or inputs
    • flush

      void flush()
      Exports everything queued now, waiting at most the export timeout.
    • flush

      void flush(Duration timeout)
      Exports everything queued now.
      Parameters:
      timeout - maximum wait
    • flushAsync

      CompletableFuture<Void> flushAsync(Duration timeout)
      Asynchronous flush(Duration).
      Parameters:
      timeout - maximum wait
      Returns:
      completes when the queued records were exported
    • close

      void close()
      Flushes and shuts down; idempotent.
      Specified by:
      close in interface AutoCloseable
    • closeAsync

      CompletableFuture<Void> closeAsync()
      Asynchronous close().
      Returns:
      completes when the client is closed
    • stats

      BatchStats stats()
      Current counters.
      Returns:
      stats
    • logger

      default Logger logger()
      Returns a logger facade without a name.
      Returns:
      logger (minimum severity INFO)
    • logger

      default Logger logger(String name)
      Returns a named logger facade.
      Parameters:
      name - logger name (attribute logger.name)
      Returns:
      logger (minimum severity INFO)
    • logger

      default Logger logger(String name, Map<String,?> attributes)
      Returns a named logger facade with fixed attributes.
      Parameters:
      name - logger name (attribute logger.name; empty for none)
      attributes - attributes added to every record
      Returns:
      logger (minimum severity INFO)