Skip to content

Commit

Permalink
Change default log level to ERROR and make some errors more descrip…
Browse files Browse the repository at this point in the history
…tive (#143)

* Add more descriptive error

* Change log level from error to warn for unhandled kinds

* Set default log level to error

* Add change log
  • Loading branch information
daogrady authored Jan 16, 2024
1 parent b0e3c79 commit b2c0ca6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
Expand Down
4 changes: 2 additions & 2 deletions lib/visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}'.`)
}
}

Expand Down

0 comments on commit b2c0ca6

Please sign in to comment.