Skip to content

Conversation

@john-u
Copy link
Contributor

@john-u john-u commented Apr 19, 2022

Checklist

  • I have read the CONTRIBUTING document
  • Any required documentation has been added
  • My code follows the code style of this project (npm run lint produces no warnings/errors)
  • I have added tests to cover my changes

@john-u john-u requested review from bflorian and rossiam April 19, 2022 20:32
@changeset-bot
Copy link

changeset-bot bot commented Apr 19, 2022

🦋 Changeset detected

Latest commit: fdd292b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@smartthings/cli Patch
@smartthings/cli-lib Patch
@smartthings/cli-testlib Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@john-u john-u force-pushed the feat-easy-debug branch 2 times, most recently from 6f33072 to 7a5319b Compare April 20, 2022 15:02
get logger(): log4js.Logger {
if (!this._logger) {
this._logger = log4js.getLogger('cli')
this._logger = log4js.getLogger(`cli.${this.constructor.name}`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives us some runtime context for free via log4js "Categories inheritance". All logs will be routed to the default category, or to the cli category if defined.

@john-u john-u marked this pull request as ready for review April 20, 2022 17:15
@john-u john-u marked this pull request as draft April 20, 2022 17:22
Debug logging can be enabled via the `ST_DEBUG` environment variable. This will log at debug level to the console as well as the default log file.

```console
ST_DEBUG=true smartthings <command>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used SMARTTHINGS_PROFILE for the environment variable used to set the profile and SMARTTHINGS_TOKEN for one that can be used for tokens. We should probably stick to spelling out SMARTTHINGS or change those to match this format.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will switch to SMARTTHINGS_DEBUG.

* rest-client - This category is used for the SDK that interfaces with the API.
Turn this on to see detailed information for HTTP calls are made to SmartThings.
* cli - This is the generic logger used by the CLI.
* `cli` - Generic logger used by the CLI. Log entries will have the Command name appended. (ex. `cli.DriversCommand`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to capitalize "Command" here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, fixed.

@john-u john-u marked this pull request as ready for review April 20, 2022 22:08
@john-u john-u merged commit 356a24b into SmartThingsCommunity:master Apr 21, 2022
@john-u john-u deleted the feat-easy-debug branch April 21, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants