Skip to main content

Configuration

You can configure Apitally via a configuration object.
import { Hono } from "hono";
import { useApitally } from "apitally/hono";

const app = new Hono();

useApitally(app, {
  clientId: "your-client-id",
  env: "dev",
  requestLogging: {
    enabled: true,
    // other parameters ...
  },
});
See the setup guides for more examples.

Parameters

The following configuration parameters are available. Only clientId and env are required.
ParameterDescriptionTypeDefault
clientIdClient ID for your application. Find it on the Setup instructions page for your app.string
envName of the environment, e.g. prod or dev. The environment will be automatically created if it doesn’t exist.stringdev
requestLoggingConfiguration options for request logging. See table below.object
appVersionThe current version of your application, e.g. 1.0.0.string
loggerA custom logger instance. If not provided, a default logger is created automatically.object
The requestLogging parameter is an object with the following properties:
ParameterDescriptionTypeDefault
enabledWhether request logging is enabled.booleanfalse
logQueryParamsWhether to include query parameters in the logs. If disabled, these will be stripped from the request URLs logged.booleantrue
logRequestHeadersWhether to include request headers in the logs. Default masking for common sensitive headers (e.g. Authorization) applies.booleanfalse
logRequestBodyWhether to include the request body in the logs. Only JSON and text are supported, up to 50 KB.booleanfalse
logResponseHeadersWhether to include response headers in the logs.booleantrue
logResponseBodyWhether to include the response body in the logs. Only JSON and text are supported, up to 50 KB.booleanfalse
logExceptionWhether to include exception details in the logs.booleantrue
captureLogsWhether to capture application logs emitted during request handling.booleanfalse
captureTracesWhether to enable tracing with OpenTelemetry.booleanfalse
maskQueryParamsArray of regular expressions for matching query parameters to mask. These are in addition to the default masking patterns.RegExp[][]
maskHeadersArray of regular expressions for matching headers to mask. These are in addition to the default masking patterns.RegExp[][]
maskBodyFieldsArray of regular expressions for matching request/response body fields to mask. These are in addition to the default masking patterns.RegExp[][]
maskRequestBodyCallbackCallback function for masking the request body. Takes one parameter request and returns the request body as Buffer or null.Function-
maskResponseBodyCallbackCallback function for masking the response body. Takes two parameters request and response and returns the response body as Buffer or null.Function-
excludePathsArray of regular expressions for matching paths to exclude from logging.RegExp[][]
excludeCallbackCallback function for excluding requests from logging. Takes two parameters request and response and returns true, if the request should be excluded, or false otherwise.Function-