From b2c0ca68d6d3e739f82cfabf6b5dc82f9e69fdc7 Mon Sep 17 00:00:00 2001 From: Daniel O'Grady <103028279+daogrady@users.noreply.github.com> Date: Tue, 16 Jan 2024 08:46:05 +0100 Subject: [PATCH] Change default log level to `ERROR` and make some errors more descriptive (#143) * Add more descriptive error * Change log level from error to warn for unhandled kinds * Set default log level to error * Add change log --- CHANGELOG.md | 3 +++ lib/cli.js | 2 +- lib/visitor.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fbe655a..2c189d04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). The format is based on [Keep a Changelog](http://keepachangelog.com/). ## Version 0.16.0 - TBD +### Changed +- Changed default log level from `NONE` to `ERROR`. See the doc to manually pass in another log level for cds-typer runs + ### Fixed - Externally defined enums can now be used as parameter types in actions diff --git a/lib/cli.js b/lib/cli.js index 8f7733ed..87534e12 100755 --- a/lib/cli.js +++ b/lib/cli.js @@ -23,7 +23,7 @@ const flags = { logLevel: { desc: `Minimum log level that is printed.`, allowed: Object.keys(Levels), - default: Object.keys(Levels).at(-1), + default: Levels.ERROR, }, jsConfigPath: { desc: `Path to where the jsconfig.json should be written.${EOL}If specified, ${toolName} will create a jsconfig.json file and${EOL}set it up to restrict property usage in types entities to${EOL}existing properties only.`, diff --git a/lib/visitor.js b/lib/visitor.js index c5f4fa02..2c952cb6 100644 --- a/lib/visitor.js +++ b/lib/visitor.js @@ -280,7 +280,7 @@ class Visitor { } if (singular in this.csn.xtended.definitions) { this.logger.error( - `Derived singular '${singular}' for your entity '${name}', already exists. The resulting types will be erronous. Please consider using '@singular:'/ '@plural:' annotations in your model to resolve this collision.` + `Derived singular '${singular}' for your entity '${name}', already exists. The resulting types will be erronous. Consider using '@singular:'/ '@plural:' annotations in your model or move the offending declarations into different namespaces to resolve this collision.` ) } file.addClass(singular, name) @@ -454,7 +454,7 @@ class Visitor { this.#printService(name, entity) break default: - this.logger.error(`Unhandled entity kind '${entity.kind}'.`) + this.logger.debug(`Unhandled entity kind '${entity.kind}'.`) } }