-
Notifications
You must be signed in to change notification settings - Fork 461
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
Enhanced debugging features: #870
base: master
Are you sure you want to change the base?
Conversation
1. Log request uri in server request handler for log level debug. I prefer to log this level info in mny fork because it enables quick diagnosis when my Alexa speech skill has misheard what I said. But doing it on debug level is more consistent with the original program. 2. Add /loglevel get request which implements ability to change the process NODE_LOG_LEVEL (one of trace, debug, info, warn, or error (and off which is a synonym for error)). Document the command in static doc content. This is very useful when the code is running in a container. Especially if you add it to your alexa skill as I have.
add apple music playlist support
|
||
|
||
// Change node environment log level on request. | ||
if (/^\/loglevel\/.+$/.test(req.url)) { |
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 could be simplified with req.url.startsWith('/loglevel/')
, no need for a regexp.
@@ -14,7 +14,8 @@ const discovery = new SonosSystem(settings); | |||
const api = new SonosHttpAPI(discovery, settings); | |||
|
|||
var requestHandler = function (req, res) { | |||
req.addListener('end', function () { | |||
logger.debug(`request: ${req.url}`); | |||
req.addListener('end', function () { |
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.
Wrong indentation, it's two spaces.
let param = params[1]; | ||
switch (param) { | ||
case 'off': | ||
param = 'error'; |
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.
Hm, I don't follow what off
would actually set. I would also like that just getting /loglevel
would actually return the current loglevel.
fix: use correct variable for shuffle response
Log request uri in server request handler for log level debug. I prefer to log this level info in mny fork because it enables quick diagnosis when my Alexa speech skill has misheard what I said. But doing it on debug level is more consistent with the original program.
Add /loglevel get request which implements ability to change the process NODE_LOG_LEVEL (one of trace, debug, info, warn, or error (and off which is a synonym for error)). Document the command in static doc content.
This is very useful when the code is running in a container. Especially if you add it to your alexa skill as I have.