A transport for sending logs to Axiom.co with the LogLayer logging library.
npm install @loglayer/transport-axiom @axiomhq/js serialize-error loglayer
import { LogLayer } from 'loglayer';
import { serializeError } from 'serialize-error';
import { AxiomTransport } from '@loglayer/transport-axiom';
import { Axiom } from '@axiomhq/js';
// Create the Axiom client
const axiom = new Axiom({
token: process.env.AXIOM_TOKEN,
// Optional: other Axiom client options
// orgId: 'your-org-id',
// url: 'https://cloud.axiom.co',
});
// Create the LogLayer instance with AxiomTransport
const logger = new LogLayer({
errorSerializer: serializeError,
transport: new AxiomTransport({
logger: axiom,
dataset: 'your-dataset',
}),
});
logger.info('Hello world');
For configuration options and examples, visit https://loglayer.dev/transports/axiom