In some circumstances, when the usual output can’t be used for printing logs, the logger will be configured to redirect output to the usual error (
os.Stderr) with the identical impact.
There are a few issues to concentrate on whenever you use the out-of-process logging:
Logger.LogSync()behave the identical approach when the logger is configured with the out-of-process logging choice. They write the Jsonified logs to the offered io.Write author. And an exterior logging agent determines the logs’ assortment and ingestion.
You wouldn’t have management over the Log ID. All logs which are ingested by the logging agent or the built-in help of the managed service (e.g. Cloud Run) will use the Log ID that’s decided out-of-process.
Extra management over batch ingestion
While you ingest logs utilizing Logger.Log() perform, the asynchronous ingestion batches a number of log entries collectively and ingest them utilizing the
entries.write Logging API. If the ingestion of any of the mixture logs fails, no logs get ingested. Beginning with this launch you possibly can management this logic by opting within the partial success flag. When the flag is about, the Logging API tries to ingest all logs, even when another log entry fails as a result of a everlasting error resembling INVALID_ARGUMENT or PERMISSION_DENIED. This selection will be opted-in when creating a brand new logger utilizing the
PartialSuccess logger choice: