Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

kshartman
Copy link

  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.

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)) {
Copy link
Owner

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 () {
Copy link
Owner

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';
Copy link
Owner

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
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.

None yet

2 participants