npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sanjay-sde/cap-js-log-control

v0.3.0

Published

CAP plugin for controlling CDS logger verbosity and OpenTelemetry DiagLogger noise — reduce log clutter, surface real errors

Readme

cap-js-log-control

CAP plugin for controlling CDS logger verbosity and OpenTelemetry DiagLogger noise — reduce log clutter, surface real errors.

Problem

SAP CAP applications on Cloud Foundry generate excessive log noise that buries real errors:

  • odata logger — logs every incoming OData request with full HTTP headers JSON blobs
  • remote logger — logs every outgoing remote service call with full headers
  • OpenTelemetry DiagLogger@cap-js/telemetry OTLP gRPC exporters emit diagnostic logs that bypass cds.log entirely

Before:

STDOUT {"level":"info","logger":"odata","msg":"POST /assets/$batch",...<3KB of headers>}
STDOUT {"level":"debug","logger":"remote","msg":"GET <api>/... Executing via @sap-cloud-sdk",...}
STDERR ExporterError: Export... failed  [repeated 50x from OTel gRPC]
STDERR Error: The request has no query  ← REAL error, buried

After:

STDERR Error: The request has no query  ← now visible immediately

Installation

npm install cap-js-log-control

CAP auto-discovers the plugin via cds-plugin.js — no code changes needed.

Configuration

Quick Start (zero config)

The plugin works out of the box with sensible defaults:

  • odatawarn
  • remotewarn
  • telemetrywarn
  • OpenTelemetry DiagLogger → ERROR

Plugin Config (cds.logControl)

Add to package.json or .cdsrc.json:

{
  "cds": {
    "logControl": {
      "enabled": true,
      "otelDiagLevel": "ERROR",
      "levels": {
        "odata": "warn",
        "remote": "warn",
        "telemetry": "warn"
      }
    }
  }
}

Native CDS Log Levels (also supported)

You can also use the standard CDS log.levels format — the plugin reads both:

{
  "cds": {
    "[development]": {
      "log": {
        "levels": {
          "odata": "error",
          "remote": "error"
        }
      }
    }
  }
}

Priority: cds.logControl.levels overrides cds.log.levels when both are set for the same logger.

Per-Profile Overrides

Use CAP profiles to tune log levels per environment:

{
  "cds": {
    "logControl": {
      "enabled": true,
      "levels": {
        "odata": "warn",
        "remote": "warn"
      }
    },
    "[development]": {
      "logControl": {
        "levels": {
          "odata": "error",
          "remote": "error"
        }
      }
    },
    "[production]": {
      "logControl": {
        "otelDiagLevel": "WARN"
      }
    }
  }
}

Disable the Plugin

{
  "cds": {
    "logControl": {
      "enabled": false
    }
  }
}

Config Reference

| Option | Type | Default | Description | |--------|------|---------|-------------| | logControl.enabled | boolean | true | Master switch — set false to disable all log control | | logControl.levels | Record<string, string> | { odata: 'warn', remote: 'warn', telemetry: 'warn' } | Map of CDS logger names to log levels | | logControl.otelDiagLevel | string | 'ERROR' | OpenTelemetry DiagLogger level |

CDS Log Levels

silent | error | warn | info | debug | verbose | silly

OTel DiagLogger Levels

NONE | ERROR | WARN | INFO | DEBUG | VERBOSE | ALL

How It Works

  1. Runs at module load time — not inside a lifecycle hook — because logger noise starts during CDS bootstrap before cds.once('served') fires.
  2. Controls CDS loggers — calls cds.log(name).setLevel(level) for each configured logger.
  3. Controls OTel DiagLogger — sets diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR) to suppress OTLP exporter retry chatter.
  4. Does NOT redirect stdout/stderr — all logs still flow to CF Loggregator for cloud logging.
  5. Does NOT patch console.log — only reduces log generation at the source.

What This Plugin Does NOT Do

  • Does NOT redirect or wrap process.stdout / process.stderr
  • Does NOT patch console.log / console.error
  • Does NOT affect cloud logging — all generated logs still flow to CF Loggregator
  • Does NOT disable @cap-js/telemetry or OTLP exporters — only reduces their diagnostic output

Development

npm install
npm run build
npm test

License

Apache-2.0