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

Don't pollute stdout with warnings and errors #1279

Closed
everhardt opened this issue Jun 9, 2023 · 8 comments
Closed

Don't pollute stdout with warnings and errors #1279

everhardt opened this issue Jun 9, 2023 · 8 comments

Comments

@everhardt
Copy link
Contributor

everhardt commented Jun 9, 2023

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
I'd love for node-opcua to not pollute stdout. I think dependencies should not do that (by default). Listening to messageLogger and deal with logs there seems to be a fine alternative. This requires:

  1. A setting in the OPCUAClientOptions and the likes or process.env to enable writing to stdout. The setting should be adhered to in make_errorLog and make_warningLog.
  2. No direct console.log calls, like:

Additional context

N/A

@everhardt
Copy link
Contributor Author

I'm open to making a PR along the lines of the desired solution if you agree to it.

@erossignon
Copy link
Member

erossignon commented Jun 10, 2023

yes, please, use a warningLog

UPDATE; in fact, i am on it.

@everhardt
Copy link
Contributor Author

Many thanks! Are you also open to the first part of my question:

  1. A setting in the OPCUAClientOptions and the likes or process.env to enable writing to stdout. The setting should be adhered to in make_errorLog and make_warningLog.

I think the env variable is the easiest solution, I can make a PR for that if you like.

@erossignon
Copy link
Member

@everhardt debugLog are now cleaned-up.

Sure, please add a mechanism to enable or disable warningLog and errorLog.
warningLog and errorLog should remain active by default, as it helps developers to troubleshoot common issues and highlight areas that requires attention during development phase.

@everhardt
Copy link
Contributor Author

I'm sorry for my late reply, in the end I did not need to use this package anymore, so for now I won't be contributing.

@erossignon
Copy link
Member

@everhardt thank you for joining the initiative, and thank your for you contribution to the code.
Let's close the issue for the time being as the bulk of the initial issue is solved.

@mb-software
Copy link

Since this has been closed as completed I assume it should now be possible to disable stdout output? If so, how to do it? I couldn't find it in the code. Is there an env variable to control the output?
Thanks

@GusakIurii
Copy link

Greetings.
I don't quite understand, is there a solution to disable WarningLog?
If so, can you provide a short example?

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

No branches or pull requests

4 participants