Client(project=None, credentials=None, _http=None, service=None, version=None, client_info=<google.api_core.gapic_v1.client_info.ClientInfo object>, client_options=None, _use_grpc=None)
Error Reporting client. Currently Error Reporting is done by creating a Logging client.
Parameters
Name | Description |
project |
str
the project which the client acts on behalf of. If not passed falls back to the default inferred from the environment. |
credentials |
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. |
_http |
(Optional) HTTP object to make requests. Can be any object that defines |
service |
str
An identifier of the service, such as the name of the executable, job, or Google App Engine service name. This field is expected to have a low number of values that are relatively stable over time, as opposed to version, which can be changed whenever new code is deployed. |
version |
str
Represents the source code version that the developer provided, which could represent a version label or a Git SHA-1 hash, for example. If the developer did not provide a version, the value is set to default. |
_use_grpc |
bool
(Optional) Explicitly specifies whether to use the gRPC transport or HTTP. If unset, falls back to the |
client_info |
The client info used to send a user-agent string along with API requests. If |
client_options |
(Optional) Client options used to set user options on the client. API Endpoint should be set through client_options. |
Properties
report_errors_api
Helper for logging-related API calls.
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs
Type | Description |
| A class that implements the report errors API. |
Methods
report
report(message, http_context=None, user=None)
Reports a message to Error Reporting
https://cloud.google.com/error-reporting/docs/formatting-error-messages
Name | Description |
message |
str
A user-supplied message to report |
http_context |
:class
The HTTP request which was processed when the error was triggered. |
user |
str
The user who caused or was affected by the crash. This can be a user ID, an email address, or an arbitrary token that uniquely identifies the user. When sending an error report, leave this field empty if the user was not logged in. In this case the Error Reporting system will use other data, such as remote IP address, to distinguish affected users. Example: .. code-block:: python >>> client.report("Something went wrong!") |
report_exception
report_exception(http_context=None, user=None)
Reports the details of the latest exceptions to Error Reporting.
Name | Description |
http_context |
:class
The HTTP request which was processed when the error was triggered. |
user |
str
The user who caused or was affected by the crash. This can be a user ID, an email address, or an arbitrary token that uniquely identifies the user. When sending an error report, leave this field empty if the user was not logged in. In this case the Error Reporting system will use other data, such as remote IP address, to distinguish affected users. Example:: >>> try: >>> raise NameError >>> except Exception: >>> client.report_exception() |