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

Move debug output to STDERR #1543

Merged
merged 1 commit into from Jan 18, 2017
Merged

Move debug output to STDERR #1543

merged 1 commit into from Jan 18, 2017

Conversation

kke
Copy link
Contributor

@kke kke commented Dec 12, 2016

Fixes #1542

@@ -12,7 +12,7 @@ module Common

def logger
return @logger if @logger
@logger = Logger.new(STDOUT)
@logger = Logger.new(ENV["DEBUG"] ? STDERR : STDOUT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the Logger just always use STDERR?

@SpComb
Copy link
Contributor

SpComb commented Dec 12, 2016

Could all of the ENV["DEBUG"] && STDERR.puts(...) be replaced with logger.debug(...), or logger.debug { ... } to keep the lazy evaluation?

@@ -46,7 +46,7 @@ def initialize(api_url, token = nil, options = {})
uri = URI.parse(@api_url)
@host = uri.host

@logger = Logger.new(STDOUT)
@logger = Logger.new(ENV["DEBUG"] ? STDERR : STDOUT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least here this can just be STDERR, since there are only logger.debug ... calls in the class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the logging should be unified anyways at some point.

@timolehto
Copy link

Just a thought, but couldn't you just provide an option for outputting the configs to a file instead of stdout i.e. something like: kontena vpn config -f kontena.vpn.config?

@kke
Copy link
Contributor Author

kke commented Dec 12, 2016

This will also help with piping to other commands when debug=true.

@timolehto
Copy link

True

@kke kke added this to the 1.0.3 milestone Dec 20, 2016
@nevalla nevalla modified the milestones: 1.0.3, 1.1.0 Dec 20, 2016
@kke kke merged commit d3c0bb3 into master Jan 18, 2017
@kke kke deleted the feature/debug_to_stderr branch January 18, 2017 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants