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

Set Winston log level to "debug" #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

gvolt
Copy link

@gvolt gvolt commented Apr 6, 2022

Fixes #74

@volumio
Copy link
Owner

volumio commented Apr 6, 2022

Log is not set on verbose to not pollute logs.
But it could be a good thing to have, just not always.

I propose:

  • Set a global env variable which defines the current log status
  • So in plugins, when in dev mode, the env variable is changed
    What do ou think?

@gvolt
Copy link
Author

gvolt commented Apr 6, 2022

I am currently working on adding a selector list to the config page of plugins which would let the user set the logging level from "off" to "debug" - so some sort of a global variable. Default would be "error" or could be "off". But it might be overkill and I will consider switching on/off logging depending on dev mode. Is there a method to query if dev mode is on or would one just check of "/data/testplugins" exists?

Would it make sense to use winston's filter function to make controllable what type of messages are shown?

@volumio
Copy link
Owner

volumio commented Apr 6, 2022

Yeah, I think that this will be an overkill.
DEV mode I think it's the wisest idea ;)

You can just check /data/testplugins existence

Or even better, just provide it as a manual flag that plugin developer can use during work. Or a command line command from volumio plugin which sets the logging to desired level by adding the info to a specific file

@gvolt
Copy link
Author

gvolt commented Apr 6, 2022

"... Or a command line command from volumio plugin which sets the logging to desired level by adding the info to a specific file": Wouldn't that require "pluginhelper.js" to be extended or did I misunderstand "volumio plugin"?

@volumio
Copy link
Owner

volumio commented Apr 6, 2022

Yes, exactly. Which IMHO would be a good tool for plugins developer

@gvolt
Copy link
Author

gvolt commented Apr 6, 2022

Just another thought on using "/data/testplugins": I think quite a lot of users have set Test Plugins mode on and leave it at this. If plugin's just rely on the testplugins file extensive logging will still happen on many systems where it is not required/wanted. So IMHO a dedictated flag file e.g. in "/data/configuration/plugin_type/plugin_name" or maybe in "/data/plugins/plugin_type/plugin_name" would be the better choice - or a new volumio plugin command.

Since I never tried it: Would "volumio plugin" also work from the the directory of a plugin already installed, i.e. from "/data/plugins/plugin_type/plugin_name"?

@volumio
Copy link
Owner

volumio commented Apr 6, 2022

I agree, IMHO we shall just add an entry to plugin

volumio plugin debugmode

which toggles the creation of a file like /data/plugins/debugmode

If this file is there, we set to debug, otherwise we don't.
This will work on global volumio, not a single plugin

@gvolt
Copy link
Author

gvolt commented Apr 6, 2022

IMHO that would be a good compromise. Maybe an according button on the "dev" page makes sense, too.

BTW: Would you prefer plugin's logging to be completely silenced by default (even error messages)?

@volumio
Copy link
Owner

volumio commented Apr 6, 2022

Yeah I agree.

No, I would leave plugin logging as they are now ;)

@gvolt
Copy link
Author

gvolt commented Apr 6, 2022

Ok, so bottom line the "debugmode" file should only unlock "self.logger.debug"?

@volumio
Copy link
Owner

volumio commented Apr 6, 2022

Yep

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.

Winston log level too low
2 participants