Return level name, not level itself (make consistent with setter).

This commit is contained in:
Andris Raugulis 2016-10-06 15:18:39 +03:00
parent 301a27ae27
commit 4b456dd01e

View File

@ -100,7 +100,9 @@ class Output(object):
@property @property
def minlevel(self): def minlevel(self):
return self.__minlevel if self.__minlevel < len(self.LEVELS):
return self.LEVELS[self.__minlevel]
return 'unknown'
@minlevel.setter @minlevel.setter
def minlevel(self, name): def minlevel(self, name):
@ -122,7 +124,7 @@ class Output(object):
def __getattr__(self, name): def __getattr__(self, name):
if name == 'head' and self.batch: if name == 'head' and self.batch:
return lambda x: None return lambda x: None
if not self.getlevel(name) >= self.minlevel: if not self.getlevel(name) >= self.__minlevel:
return lambda x: None return lambda x: None
if self.colors and os.name == 'posix' and name in self.COLORS: if self.colors and os.name == 'posix' and name in self.COLORS:
color = u'\033[0;{0}m'.format(self.COLORS[name]) color = u'\033[0;{0}m'.format(self.COLORS[name])