From 38cedccdf5d279ecadc7baccc03c202b0131d0df Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 11 May 2014 10:19:21 -0300 Subject: [PATCH] propellor spin --- Propellor/CmdLine.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Propellor/CmdLine.hs b/Propellor/CmdLine.hs index ad04abe..66eb042 100644 --- a/Propellor/CmdLine.hs +++ b/Propellor/CmdLine.hs @@ -340,12 +340,17 @@ checkDebugMode = go =<< getEnv "PROPELLOR_DEBUG" where go (Just s) | s == "1" = do - f <- setFormatter - <$> streamHandler stderr DEBUG - <*> pure (simpleLogFormatter "[$time] $msg") - updateGlobalLogger rootLoggerName $ - setLevel DEBUG . setHandlers [f] - go _ = noop + f <- setFormatter + <$> streamHandler stderr DEBUG + <*> pure (simpleLogFormatter "[$time] $msg") + updateGlobalLogger rootLoggerName $ + setLevel DEBUG . setHandlers [f] + go _ = whenM ((==) "root" <$> myUserName) $ do + f <- setFormatter + <$> fileHandler "/usr/local/bin/propellor/log" DEBUG + <*> pure (simpleLogFormatter "[$time] $msg") + updateGlobalLogger rootLoggerName $ + setLevel DEBUG . setHandlers [f] -- Parameters can be passed to both ssh and scp, to enable a ssh connection -- caching socket.