From a664325e44fb8400a316713339c5424909c49857 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 10 Dec 2012 19:32:27 +0100 Subject: [PATCH] Reduce logging level in tests This allows tests to execute IO actions which have logging as a side effect, without polluting the stderr too much. A better solution would be that we have fine-grained control over loggers, so that tests can run with their own logging, etc. etc.. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- htest/test.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htest/test.hs b/htest/test.hs index 0a31d3dcc..8d71c247c 100644 --- a/htest/test.hs +++ b/htest/test.hs @@ -28,6 +28,7 @@ module Main(main) where import Data.Monoid (mappend) import Test.Framework import System.Environment (getArgs) +import System.Log.Logger import Test.Ganeti.TestImports () import Test.Ganeti.Attoparsec @@ -120,4 +121,8 @@ main :: IO () main = do ropts <- getArgs >>= interpretArgsOrExit let opts = maybe defOpts (defOpts `mappend`) $ ropt_test_options ropts + -- silence the logging system, so that tests can execute I/O actions + -- which create logs without polluting stderr + -- FIXME: improve this by allowing tests to use logging if needed + updateGlobalLogger rootLoggerName (setLevel EMERGENCY) defaultMainWithOpts allTests (ropts { ropt_test_options = Just opts }) -- GitLab