Zuplo logo

Custom Fields Available on All Logging Policies

Changelog entry for Custom Fields Available on All Logging Policies

Custom Fields Available on All Logging Policies

A new fields option is now available across all logging plugins. This addition enables you to append arbitrary custom fields to each log entry, providing additional context and information in your logs.

For example, using our Google Cloud Logging plugin:

import {
  RuntimeExtensions,
  GoogleCloudLoggingPlugin,
  environment,
} from "@zuplo/runtime";

export function runtimeInit(runtime: RuntimeExtensions) {
  runtime.addPlugin(
    new GoogleCloudLoggingPlugin({
      logName: "projects/my-project/logs/my-api",
      serviceAccountJson: environment.GCP_SERVICE_ACCOUNT,
      fields: {
        myCustomField: "value",
        anotherCustomField: "value2",
      },
    }),
  );
}

You can use this feature to include relevant metadata, application-specific details, or contextual information that may be useful for debugging or analysis purposes.