From c534a242a9b523017dd70c80a0c9513ffb388123 Mon Sep 17 00:00:00 2001 From: Ludwig Stockbauer-Muhr <35834861+stockbal@users.noreply.github.com> Date: Mon, 2 Dec 2024 07:54:13 +0100 Subject: [PATCH] feat: adds `log` to `cds.env` (#353) --- CHANGELOG.md | 1 + apis/env.d.ts | 8 ++++++++ test/typescript/apis/project/cds-env.ts | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7717216..18528b5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). The format is based on [Keep a Changelog](http://keepachangelog.com/). ## Version 0.9.0 - tbd +- Adds missing properties for `log` in `cds.env` ## Version 0.8.0 - 24-11-26 diff --git a/apis/env.d.ts b/apis/env.d.ts index ba4a4c84..60ecda8b 100644 --- a/apis/env.d.ts +++ b/apis/env.d.ts @@ -1,3 +1,5 @@ +import { levels } from './log' + /** * Access to the configuration for Node.js runtime and tools. * The object is the effective result of configuration merged from various sources, @@ -14,6 +16,12 @@ export const env: { [key: string]: any, }, profiles: string[], + log: { + user: boolean, + levels: Record>, + als_custom_fields: Record, + cls_custom_fields: string[], + }, requires: env.Requires, folders: { app: string, diff --git a/test/typescript/apis/project/cds-env.ts b/test/typescript/apis/project/cds-env.ts index 433e8e92..83d92aee 100644 --- a/test/typescript/apis/project/cds-env.ts +++ b/test/typescript/apis/project/cds-env.ts @@ -9,6 +9,11 @@ env.folders.foo = '' env.build = '' env.hana = '' +env.log.levels['cli'] === 'debug' +env.log.cls_custom_fields.length +env.log.als_custom_fields['query'] === 0 +Object.keys(env.log.als_custom_fields) + env.requires.auth.kind = '' env.requires.auth.credentials!.url = '' env.requires.auth.credentials!.clientid = ''