Skip to content

Commit

Permalink
feat: adds log to cds.env (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
stockbal authored Dec 2, 2024
1 parent abef4b0 commit c534a24
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions apis/env.d.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -14,6 +16,12 @@ export const env: {
[key: string]: any,
},
profiles: string[],
log: {
user: boolean,
levels: Record<string, Lowercase<keyof typeof levels>>,
als_custom_fields: Record<string, number>,
cls_custom_fields: string[],
},
requires: env.Requires,
folders: {
app: string,
Expand Down
5 changes: 5 additions & 0 deletions test/typescript/apis/project/cds-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down

0 comments on commit c534a24

Please sign in to comment.