@loglayer/transport-logflare
v1.0.9
Published
Logflare transport for the LogLayer logging library.
Downloads
561
Maintainers
Readme
Logflare Transport for LogLayer
A Logflare transport for the LogLayer logging library.
Ships logs to Logflare using the HTTP transport with Logflare-specific configuration. Features include:
- Automatic Logflare JSON format
- Built on top of the robust HTTP transport
- Retry logic with exponential backoff
- Rate limiting support
- Batch sending with configurable size and timeout
- Error and debug callbacks
- Support for self-hosted Logflare instances
Installation
npm install loglayer @loglayer/transport-logflare serialize-errorUsage
import { LogLayer } from 'loglayer'
import { LogflareTransport } from "@loglayer/transport-logflare"
import { serializeError } from "serialize-error";
const log = new LogLayer({
errorSerializer: serializeError,
contextFieldName: null, // recommended based on testing
metadataFieldName: null, // recommended based on testing
transport: new LogflareTransport({
sourceId: "YOUR-SOURCE-ID",
apiKey: "YOUR-API-KEY",
})
})
// Use the logger
log.info("This is a test message");
log.withMetadata({ userId: "123" }).error("User not found");Documentation
For more details, visit https://loglayer.dev/transports/logflare
