Add some comments explaining split_loggers flag logic
split_loggers can be None, True or False, but there are no comments explaining why or what is happening. Explain ourselves. Change-Id: I6ccc2cd44f388c7c9d6d63b239a9f5f068c9cbfc
This commit is contained in:
parent
56b2c89c39
commit
8175c611ed
|
@ -273,6 +273,8 @@ class Session(object):
|
|||
if discovery_cache is None:
|
||||
discovery_cache = {}
|
||||
self._discovery_cache = discovery_cache
|
||||
# NOTE(mordred) split_loggers kwarg default is None rather than False
|
||||
# so we can distinguish between the value being set or not.
|
||||
self._split_loggers = split_loggers
|
||||
|
||||
if timeout is not None:
|
||||
|
@ -326,9 +328,20 @@ class Session(object):
|
|||
return header
|
||||
|
||||
def _get_split_loggers(self, split_loggers):
|
||||
"""Get a boolean value from the various argument sources.
|
||||
|
||||
We default split_loggers to None in the kwargs of the Session
|
||||
constructor so we can track set vs. not set. We also accept
|
||||
split_loggers as a parameter in a few other places. In each place
|
||||
we want the parameter, if given by the user, to win.
|
||||
"""
|
||||
# None is the default value in each method's kwarg. None means "unset".
|
||||
if split_loggers is None:
|
||||
# If no value was given, try the value set on the instance.
|
||||
split_loggers = self._split_loggers
|
||||
if split_loggers is None:
|
||||
# If neither a value was given on the method, nor a value was given
|
||||
# on the Session constructor, then the value is False.
|
||||
split_loggers = False
|
||||
return split_loggers
|
||||
|
||||
|
|
Loading…
Reference in New Issue