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.