Skip to content

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.

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.

2 participants