Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1.87 KB

README.md

File metadata and controls

56 lines (44 loc) · 1.87 KB

Axiom Go Adapter for uber-go/zap

Adapter to ship logs generated by uber-go/zap to Axiom.

Quickstart

Follow the Axiom Go Quickstart to install the Axiom Go package and configure your environment.

Import the package:

// Imported as "adapter" to not conflict with the "uber-go/zap" package.
import adapter "github.com/axiomhq/axiom-go/adapters/zap"

You can also configure the adapter using options passed to the New function:

core, err := adapter.New(
    adapter.SetDataset("AXIOM_DATASET"),
)

To configure the underlying client manually either pass in a client that was created according to the Axiom Go Quickstart using SetClient or pass client options to the adapter using SetClientOptions.

import (
    "github.com/axiomhq/axiom-go/axiom"
    adapter "github.com/axiomhq/axiom-go/adapters/zap"
)

// ...

core, err := adapter.New(
    adapter.SetDataset("AXIOM_DATASET"),
    adapter.SetClientOptions(
        axiom.SetPersonalTokenConfig("AXIOM_TOKEN", "AXIOM_ORG_ID"),
    ),
)

Important

The adapter uses a buffer to batch events before sending them to Axiom. This buffer must be flushed explicitly by calling Sync. Refer to the zap documentation for details and checkout out the example.