This package provides a Swift implementation for error reporting on the Google Cloud Platform.
import GoogleCloudErrorReporting
let errorReportingService = ErrorReportingService()
Task { try await errorReportingService.run() }
try await service.report(
date: Date(),
message: "Error doing testing",
source: "error-reporting.test",
file: #file,
function: #function,
line: #line
)This will automatically authenticate with Google Cloud and send errors to Cloud Error Reporting.
See Google Cloud Auth for Swift for supported authentication methods.
There's also a log handler which can be used with SwiftLog.
import Logging
import GoogleCloudErrorReporting
let errorReportingService = ErrorReportingService()
Task { try await errorReportingService.run() }
LoggingSystem.bootstrap { label in
ErrorReportingLogHandler(service: errorReportingService, label: label)
}