You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,11 @@
1
1
# GoogleCloudLogging
2
2
3
-
Event logging for client applications on [Apple platforms](#supported-platforms) with support for offline work and automatic upload to [Google Cloud (GCP)](https://cloud.google.com). The package depends on [SwiftLog](https://github.com/apple/swift-log) - an official logging API for Swift, so it can be easly integrated into the project and combined with other logging backends. Log events are stored locally in the [JSON Lines](http://jsonlines.org) file format and bulk uploaded to GCP using the [Cloud Logging API v2](https://cloud.google.com/logging/docs/reference/v2/rest) at time intervals, upon defined event or explicit request. _And yes, it logs itself! (with recursion protection)_ 🤘
3
+
Event logging for client applications on [Apple platforms](#supported-platforms) with support for offline work and automatic upload to [Google Cloud (GCP)](https://cloud.google.com). The package depends on [SwiftLog](https://github.com/apple/swift-log) - an official logging API for Swift, so it can be easly integrated into the project and combined with other logging backends. Log events are stored locally in the [JSON Lines](http://jsonlines.org) file format and bulk uploaded to GCP using the [Cloud Logging API v2](https://cloud.google.com/logging/docs/reference/v2/rest) at time intervals, upon defined event or explicit request.
4
+
5
+
> And yes, it logs itself! (with recursion protection) 🤘
4
6
5
7
## Rationale
6
-
Googlerecommended logging solution for client applications is Analytics framework, which is now part of the Firebase SDK. Here is a comparison of that framework and this library in terms of logging:
8
+
Google-recommended logging solution for client applications is the Analytics framework, which is now part of the Firebase SDK. Here is a comparison of their framework and this library in terms of logging:
7
9
Library | FirebaseAnalytics | GoogleCloudLogging
8
10
--- | --- | ---
9
11
Platform | Mobile only. _Even Catalyst is not currently supported._ | All modern Apple's OSs. _It is essential for development of universal SwiftUI apps._
Open your application project in Xcode 11 or later, go to menu `File -> Swift Packages -> Add Package Dependency...` and paste the package repository URL `https://github.com/DnV1eX/GoogleCloudLogging.git`.
20
22
21
23
### Create Service Account
22
-
In your web browser open the [Google Cloud Console](https://console.cloud.google.com) and create a new project. In `IAM & Admin -> Service Accounts` create a service account choosing `Logging -> Logs Writer` role. In the last step, create and download private key choosing `JSON` format. You need to include this file in your application bundle, just drag the file into the Xcode project and tick the desired targets in the file inspector.
24
+
In your web browser, open the [Google Cloud Console](https://console.cloud.google.com) and create a new project. In `IAM & Admin -> Service Accounts` create a service account choosing `Logging -> Logs Writer` role. In the last step, create and download private key choosing `JSON` format. You need to include this file in your application bundle.
25
+
26
+
> Just drag the file into the Xcode project and tick the desired targets in the file inspector.
23
27
24
28
### Setup Logging
25
29
1. Import both `SwiftLog` and `GoogleCloudLogging` modules:
> `GoogleCloudLogHandler.globalMetadata` takes precedence over `Logger` metadata which in turn takes precedence over log message metadata in case of key overlapping.
75
79
76
80
### Analyze Logs
77
-
In your web browser open the [GCP Operations Logging](https://console.cloud.google.com/logs) and select your project. You will see a list of logs for a given **time range** which can be filtered by **log name**_(logger label)_, **severity**_(log level)_, **text payload**_(message)_, **labels**_(metadata)_ etc. **Resource type** for logs produced by GoogleCloudLogHandler is always _Global_.
81
+
In your web browser, open the [GCP Operations Logging](https://console.cloud.google.com/logs) and select your project. You will see a list of logs for a given **time range** which can be filtered by **log name**_(logger label)_, **severity**_(log level)_, **text payload**_(message)_, **labels**_(metadata)_ etc. **Resource type** for logs produced by GoogleCloudLogHandler is always _Global_.
78
82
79
83
> You can switch to the new Logs Viewer Preview that introduces new features, such as advanced log queries and histograms.
0 commit comments