Contents

googleapis/swift-google-logging-v2

Writes log entries and manages your Cloud Logging configuration.

Overview

The following types provide methods to make RPCs. They are a good starting point to learn about this library.

  • LoggingServiceV2Client: Service for ingesting and querying logs.
  • ConfigServiceV2Client: Service for configuring sinks used to route log entries.
  • MetricsServiceV2Client: Service for configuring logs-based metrics.

Quickstart

The following example demonstrates using LoggingServiceV2Client:

import Foundation
import GoogleCloudLoggingV2
import GoogleApi
import GoogleLongRunning

func sample(projectId: String, ) async throws {
  let client = try GoogleCloudLoggingV2.LoggingServiceV2Client()
  let items = client.listLogEntriesByItems(
    request: ListLogEntriesRequest()
  .with {
    $0.resourceNames = ["projects/\(projectId)"]
  }
)
  for try await item in items {
    print("  \(item)")
  }
}

Requirements

For the minimum supported Swift version and platform requirements, see the Requirements section in the google-cloud-swift repository.

Installation

Add swift-google-logging-v2 as a package dependency:

swift package add-dependency https://github.com/googleapis/swift-google-logging-v2.git --from 0.6.0

Then add GoogleCloudLoggingV2 to your target's dependencies:

swift package add-target-dependency GoogleCloudLoggingV2 <target-name> --package swift-google-logging-v2

Troubleshooting

For questions, bug reports, or feature requests, please open an issue in the google-cloud-swift repository.

Contributing

Contributions to this library are always welcome and highly encouraged.

All development, issues, and pull requests are managed in the google-cloud-swift monorepo. See CONTRIBUTING.md for details on getting started.

License

Apache 2.0 - See LICENSE for more information.

Package Metadata

Repository: googleapis/swift-google-logging-v2

Default branch: main

README: README.md