This page explains how to send logs generated by the apex/log library to Axiom.
Use the adapter of the Axiom Go SDK to send logs generated by the apex/log library to Axiom.
The Axiom Go SDK is an open-source project and welcomes your contributions. For more information, see the GitHub repository.
Install the Axiom Go SDK and configure your environment as explained in Send data from Go app to Axiom.
In your Go app, import the apex
package. It is imported as an adapter
so that it doesn’t conflict with the apex/log
package.
Alternatively, configure the adapter using options passed to the New function:
Replace DATASET_NAME
with the name of the Axiom dataset where you want to send data.
To configure the underlying client manually, choose one of the following:
Use SetClient to pass in the client you have previously created with Send data from Go app to Axiom.
Use SetClientOptions to pass client options to the adapter.
The adapter uses a buffer to batch events before sending them to Axiom. Flush this buffer explicitly by calling Close. For more information, see the example in GitHub.
For a full reference of the adapter’s functions, see the Go Packages page.