Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Levels as Used by the CAP Node.js Runtime #1552

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Log Levels as Used by the CAP Node.js Runtime
sjvans committed Jan 9, 2025
commit 1e1d7055f34f25bb7e6069611be3e4669b12b367
11 changes: 11 additions & 0 deletions node.js/cds-log.md
Original file line number Diff line number Diff line change
@@ -205,6 +205,17 @@ cds.log('foo','debug') // switches the 'foo' logger to 'debug' level



### *Log Levels as Used by the CAP Node.js Runtime*

The CAP Node.js runtime uses the following guidelines with regards to which log level to use in which situation:

- `error`: Something went horribly wrong and it is unclear what to do (i.e., an unexpected error).
- `warn`: Something off the happy trail happened, but it can be handled (i.e., an expected error).
- `info`: A brief information on what is currently happening.
- `debug`: A detailed information on what is currently happening.
- `trace`/`silly`/`verbose` (not used by the CAP Node.js runtime): Information on what is currently happening with a ridiculous level of detail.


## cds.log.Logger

Constructs a new logger with the method signature of `{ trace, debug, log, info, warn, error }` (cf. [`console`](https://nodejs.org/api/console.html)). The default implementation maps each method to the equivalent methods of `console`.