Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Add new logging structure. Fix cockpit. #565

Merged
merged 3 commits into from
Feb 19, 2016

Conversation

dustymabe
Copy link
Contributor

No description provided.

@dustymabe
Copy link
Contributor Author

@cdrage - check out the proposed implementation and see what you think. I have one unit test failing so I'll need to track that down.

@dustymabe
Copy link
Contributor Author

@cdrage. I think I picked up all of the cockpit logging changes from your PR. Do you mind going through and making sure?

logger.info("Action/Mode Selected is: %s" % args.action)

# Finally, parse args and give error if necessary
logger.debug("Final parsed cmdline: {}".format(' '.join(cmdline)))
args = self.parser.parse_args(cmdline)
Copy link
Member

Choose a reason for hiding this comment

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

this needs to be moved up before setup_logging, passing -v doesn't work since we haven't parsed args yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm. so you are saying the logger.debug() statement needs to be moved before setup_logging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I see what you are saying now. You are saying that self.parser.parse_args() needs to be moved above the setup_logging() call. I don't think this is true because the call to self.parser.parse_known_args() should have captured --verbose from the cmdline. I'll run some tests to see if it changes things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving it down did make the test pass. Now just need to figure out what part of my logic is flawed in the first part.

Copy link
Member

Choose a reason for hiding this comment

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

@dustymabe Yeah, I'm not able to receive any debug information at all by passing -v or --verbose

@cdrage
Copy link
Member

cdrage commented Feb 19, 2016

Test is failing due to my comment about no verbose output ^^

# If connected to a tty, then default to color, else, no color
if not outputtype:
if sys.stdout.isatty():
outputtype = 'stdoutcolor'
Copy link
Member

Choose a reason for hiding this comment

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

output_type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if we should use something shorter for the cli that would make sense for a variable name as well. would --logtype on the cli work? then here we could use logtype as the var name.

Copy link
Member

Choose a reason for hiding this comment

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

logtype works

@cdrage
Copy link
Member

cdrage commented Feb 19, 2016

@dustymabe I do have to agree with you, this looks a lot better than what I had traditional proposed.

Other than the names (use cockpit_logging? and my previous comment) it looks good. I'll go ahead and test it a bit more too.

@dustymabe dustymabe force-pushed the dusty-logging-refactor branch from f909aab to f83c085 Compare February 19, 2016 16:33
# If no logtype was set then let's have a sane default
# If connected to a tty, then default to color, else, no color
if not logtype:
if sys.stdout.isatty():
Copy link
Member

Choose a reason for hiding this comment

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

👍 for this code

Adds colorized output as well as a new command line option
for choosing between different logging choices. Also adds
support for a 'cockpit' logging mode, which just prints out
select logging messages for the cockpit UI.

Fixes projectatomic#134
Add in messages that the cockpit UI is concerned with.
Also remove old print* functions from utils as they are
no longer needed.

Fixes projectatomic#432
@dustymabe dustymabe force-pushed the dusty-logging-refactor branch from f83c085 to 86e87be Compare February 19, 2016 18:19
@cdrage
Copy link
Member

cdrage commented Feb 19, 2016

LGTM 👍

dustymabe added a commit that referenced this pull request Feb 19, 2016
Add new logging structure. Fix cockpit.
@dustymabe dustymabe merged commit 38d24f3 into projectatomic:master Feb 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants