[Piglit] [Patch v2 5/5] framework: Add dummy logger that produces no output
Ilia Mirkin
imirkin at alum.mit.edu
Mon Jul 7 16:37:36 PDT 2014
On Sun, Jul 6, 2014 at 3:13 AM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> This adds a new logger option that produces no output. This is aimed at
> headless setups or for systems like jenkins where the output data isn't
> very useful.
>
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
> framework/log.py | 13 +++++++++++++
> framework/tests/log_tests.py | 3 ++-
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/framework/log.py b/framework/log.py
> index 9b9805f..c394c3c 100644
> --- a/framework/log.py
> +++ b/framework/log.py
> @@ -219,6 +219,18 @@ class VerboseLog(QuietLog):
> super(VerboseLog, self).log(value)
>
>
> +class DummyLog(BaseLog):
> + """ A Logger that does nothing """
> + def start(self, name):
> + pass
> +
> + def log(self, status):
> + pass
> +
> + def summary(self):
> + pass
> +
> +
> class LogManager(object):
> """ Creates new log objects
>
> @@ -240,6 +252,7 @@ class LogManager(object):
> LOG_MAP = {
> 'quiet': QuietLog,
> 'verbose': VerboseLog,
> + 'dummy': DummyLog,
IMHO 'none' makes more sense here than 'dummy'
Either way,
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
> }
>
> def __init__(self, logger, total):
> diff --git a/framework/tests/log_tests.py b/framework/tests/log_tests.py
> index a71f3ca..9703b11 100644
> --- a/framework/tests/log_tests.py
> +++ b/framework/tests/log_tests.py
> @@ -37,7 +37,8 @@ def test_initialize():
> check_initialize = lambda c, *a: c(*a)
>
> for name, class_ in [('QuiteLog', log.QuietLog),
> - ('VerboseLog', log.VerboseLog)]:
> + ('VerboseLog', log.VerboseLog),
> + ('DummyLog', log.DummyLog)]:
> check_initialize.description = "{} initializes".format(name)
> yield check_initialize, class_, TEST_STATE
>
> --
> 2.0.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list