@@ -10,7 +10,7 @@ module Obelisk.Command where
10import Control.Concurrent (newMVar, threadDelay)
10import Control.Concurrent (newMVar, threadDelay)
11import Control.Monad
11import Control.Monad
12import Control.Monad.IO.Class (liftIO)
12import Control.Monad.IO.Class (liftIO)
13−import Control.Monad.Log
13+import Control.Monad.Reader (ask)
14import qualified Data.Binary as Binary
14import qualified Data.Binary as Binary
15import qualified Data.ByteString.Base16 as Base16
15import qualified Data.ByteString.Base16 as Base16
16import qualified Data.ByteString.Lazy as LBS
16import qualified Data.ByteString.Lazy as LBS
@@ -26,7 +26,8 @@ import System.IO (hIsTerminalDevice, stdout)
26import System.Posix.Process (executeFile)
26import System.Posix.Process (executeFile)
28import Obelisk.App
28import Obelisk.App
29−import Obelisk.CLI.Logging (LoggingConfig (LoggingConfig), Severity (..), failWith, putLog)
29+import Obelisk.CLI.Logging (LoggingConfig (LoggingConfig, _loggingConfig_level), Severity (..), failWith,
30import Obelisk.Command.Deploy
31import Obelisk.Command.Deploy
31import Obelisk.Command.Project
32import Obelisk.Command.Project
32import Obelisk.Command.Repl
33import Obelisk.Command.Repl
@@ -185,16 +186,23 @@ isInteractiveTerm = do
186main :: IO ()
187main :: IO ()
188− -- We are not passing this as cli argument (--verbose) because run-static-io does not
189+ -- We are not passing `logLevel` as cli argument (--verbose) because run-static-io does not
189 -- pass along the cli arguments to recursive obelisks.
190 -- pass along the cli arguments to recursive obelisks.
190− verbose <- maybe False read <$> lookupEnv "VERBOSE"
191+ logLevel <- maybe Notice read <$> lookupEnv "LOGLEVEL"
191 noSpinner <- not <$> isInteractiveTerm
192 noSpinner <- not <$> isInteractiveTerm
192− loggingConfig <- LoggingConfig Debug <$> newMVar False
193+ loggingConfig <- LoggingConfig logLevel <$> newMVar False
193− let obeliskConfig = Obelisk verbose noSpinner loggingConfig
194+ let obeliskConfig = Obelisk noSpinner loggingConfig
194 runObelisk obeliskConfig $ ObeliskT main'
195 runObelisk obeliskConfig $ ObeliskT main'
196main' :: MonadObelisk m => m ()
197main' :: MonadObelisk m => m ()
197main' = do
198main' = do
200+ putLog Debug $ T.unwords
202+ , "noSpinner=" <> T.pack (show $ _obelisk_noSpinner c)
203+ , "logging-level=" <> T.pack (show $ _loggingConfig_level $ _obelisk_logging c)
198 myArgs <- liftIO getArgs
206 myArgs <- liftIO getArgs
199 --TODO: We'd like to actually use the parser to determine whether to hand off,
207 --TODO: We'd like to actually use the parser to determine whether to hand off,
200 --but in the case where this implementation of 'ob' doesn't support all
208 --but in the case where this implementation of 'ob' doesn't support all
@@ -210,7 +218,7 @@ main' = do
210 Nothing -> go as -- If not in a project, just run ourselves
218 Nothing -> go as -- If not in a project, just run ourselves
211 Just impl -> do
219 Just impl -> do
212 -- Invoke the real implementation, using --no-handoff to prevent infinite recursion
220 -- Invoke the real implementation, using --no-handoff to prevent infinite recursion
213− putLog Notice $ "Handing off to " <> T.pack impl
221+ putLog Debug $ "Handing off to " <> T.pack impl
214 liftIO $ executeFile impl False ("--no-handoff" : myArgs) Nothing
222 liftIO $ executeFile impl False ("--no-handoff" : myArgs) Nothing
215 case myArgs of
223 case myArgs of
216 "--no-handoff" : as -> go as -- If we've been told not to hand off, don't hand off
224 "--no-handoff" : as -> go as -- If we've been told not to hand off, don't hand off