@grow-codes/better-stack-logs - v0.1.1
    Preparing search index...

    Class BetterStackClient

    Client for Better Stack Logs: ingestion through the source's ingesting host (logClient, exporter, otlpExporter) and the SQL query API (query()), each with its own credentials and transport. A source token is never sent to the query host and SQL credentials never to the ingest host.

    const client = BetterStackClient.fromEnv();
    const logs = client.logClient({ resource: { "service.name": "checkout" } });
    logs.logger().info("order placed", { orderId: 42 });
    await client.close();
    Index

    The immutable configuration.

    • Flushes and closes every log client, then releases connections. Idempotent; later calls on the client (and on its exporters and query client) raise CancelledError.

      Returns Promise<void>

    • Unauthenticated liveness. With a query host: GET {queryUrl}/ping (Ok.). Ingest-only: GET {url}/ without credentials (any answer below 500 proves the host is reachable; no data is sent). Never throws except CANCELLED (also on a closed client) / CONFIG.

      Parameters

      Returns Promise<HealthStatus>

    • Authenticated round trip; returns the latency in ms. With query credentials: SELECT count() AS c FROM remote(<sourceTable>_logs) WHERE 1 = 0 (or SELECT 1 without a sourceTable). Ingest-only: posts an empty batch [] (0 events). Bad credentials → AuthenticationError. A closed client raises CancelledError.

      Parameters

      Returns Promise<number>

    • Better Stack is a SaaS without a version endpoint: always throws UnsupportedError.

      Parameters

      Returns Promise<string>