-
Notifications
You must be signed in to change notification settings - Fork 128
feat: enable debug logging via env variable #294
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
Conversation
🦋 Changeset detectedLatest commit: fdd292b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
6f33072 to
7a5319b
Compare
| get logger(): log4js.Logger { | ||
| if (!this._logger) { | ||
| this._logger = log4js.getLogger('cli') | ||
| this._logger = log4js.getLogger(`cli.${this.constructor.name}`) |
There was a problem hiding this comment.
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.
packages/cli/README.md
Outdated
| 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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
packages/cli/doc/configuration.md
Outdated
| * 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`) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, fixed.
Checklist
npm run lintproduces no warnings/errors)