@@ -15,15 +15,17 @@ Setup
15
15
Creating a Client
16
16
~~~~~~~~~~~~~~~~~
17
17
18
+ .. _Creating Client :
19
+
18
20
Before using the library, you must first set up a :doc: `Client</client> `:
19
21
20
22
.. literalinclude :: ../samples/snippets/usage_guide.py
21
23
:start-after: [START usage_client_setup]
22
24
:end-before: [END usage_client_setup]
23
25
:dedent: 4
24
26
25
- When setting up the :doc: `Client</client> `, you can also disable gRPC to put the library
26
- into HTTP mode:
27
+ When setting up the :doc: `Client</client> `, you can also :doc: ` disable gRPC</grpc-vs-http> `
28
+ to put the library into HTTP mode:
27
29
28
30
.. literalinclude :: ../samples/snippets/usage_guide.py
29
31
:start-after: [START usage_http_client_setup]
@@ -83,24 +85,24 @@ can be set by passing them as keyword arguments:
83
85
based on input type. If you want to be more explicit about the type used, you can use the following
84
86
Logger methods:
85
87
86
- - :meth: `Logger.log_text <google.cloud.logging_v2.logger.Logger.log_text> ` creates a :class: `TextEntry < google.cloud.logging_v2.entries.TextEntry> `
87
- - :meth: `Logger.log_struct <google.cloud.logging_v2.logger.Logger.log_struct> ` creates a :class: `StructEntry < google.cloud.logging_v2.entries.StructEntry> `
88
- - :meth: `Logger.log_proto <google.cloud.logging_v2.logger.Logger.log_proto> ` creates a :class: `ProtobufEntry < google.cloud.logging_v2.entries.ProtobufEntry> `
89
- - :meth: `Logger.log_empty <google.cloud.logging_v2.logger.Logger.log_empty> ` creates an empty :class: `LogEntry < google.cloud.logging_v2.entries.LogEntry> `
88
+ - :meth: `Logger.log_text <google.cloud.logging_v2.logger.Logger.log_text> ` creates a :class: `~ google.cloud.logging_v2.entries.TextEntry `
89
+ - :meth: `Logger.log_struct <google.cloud.logging_v2.logger.Logger.log_struct> ` creates a :class: `~ google.cloud.logging_v2.entries.StructEntry `
90
+ - :meth: `Logger.log_proto <google.cloud.logging_v2.logger.Logger.log_proto> ` creates a :class: `~ google.cloud.logging_v2.entries.ProtobufEntry `
91
+ - :meth: `Logger.log_empty <google.cloud.logging_v2.logger.Logger.log_empty> ` creates an empty :class: `~ google.cloud.logging_v2.entries.LogEntry `
90
92
91
93
Batch Writing Logs
92
94
------------------
93
95
94
96
By default, each log write will take place in an individual network request, which may be inefficient at scale.
95
- Instead, you can use a :class: `Batch < google.cloud.logging_v2.logger.Batch> `:
97
+ Instead, you can use a :class: `~ google.cloud.logging_v2.logger.Batch `:
96
98
97
99
.. literalinclude :: ../samples/snippets/usage_guide.py
98
100
:start-after: [START logger_log_batch]
99
101
:end-before: [END logger_log_batch]
100
102
:dedent: 4
101
103
102
104
In this case, logs are batched together, and only sent out when :func: `batch.commit <google.cloud.logging_v2.logger.Batch.commit> ` is called.
103
- To simplify things, you can also use :class: `Batch < google.cloud.logging_v2.logger.Batch> ` as a context manager:
105
+ To simplify things, you can also use :class: `~ google.cloud.logging_v2.logger.Batch ` as a context manager:
104
106
105
107
.. literalinclude :: ../samples/snippets/usage_guide.py
106
108
:start-after: [START logger_log_batch_context]
0 commit comments