@@ -10,7 +10,7 @@ module Obelisk.Command where
1010import Control.Concurrent (newMVar, threadDelay)
1111import Control.Monad
1212import Control.Monad.IO.Class (liftIO)
13−import Control.Monad.Log
13+import Control.Monad.Reader (ask)
1414import qualified Data.Binary as Binary
1515import qualified Data.ByteString.Base16 as Base16
1616import qualified Data.ByteString.Lazy as LBS
@@ -26,7 +26,8 @@ import System.IO (hIsTerminalDevice, stdout)
2626import System.Posix.Process (executeFile)
2727
2828import Obelisk.App
29−import Obelisk.CLI.Logging (LoggingConfig (LoggingConfig), Severity (..), failWith, putLog)
29+import Obelisk.CLI.Logging (LoggingConfig (LoggingConfig, _loggingConfig_level), Severity (..), failWith,
30+ putLog)
3031import Obelisk.Command.Deploy
3132import Obelisk.Command.Project
3233import Obelisk.Command.Repl
@@ -185,16 +186,23 @@ isInteractiveTerm = do
185186
186187main :: IO ()
187188main = do
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
189190 -- pass along the cli arguments to recursive obelisks.
190− verbose <- maybe False read <$> lookupEnv "VERBOSE"
191+ logLevel <- maybe Notice read <$> lookupEnv "LOGLEVEL"
191192 noSpinner <- not <$> isInteractiveTerm
192− loggingConfig <- LoggingConfig Debug <$> newMVar False
193− let obeliskConfig = Obelisk verbose noSpinner loggingConfig
193+ loggingConfig <- LoggingConfig logLevel <$> newMVar False
194+ let obeliskConfig = Obelisk noSpinner loggingConfig
194195 runObelisk obeliskConfig $ ObeliskT main'
195196
196197main' :: MonadObelisk m => m ()
197198main' = do
199+ c <- ask
200+ putLog Debug $ T.unwords
201+ [ "Obelisk"
202+ , "noSpinner=" <> T.pack (show $ _obelisk_noSpinner c)
203+ , "logging-level=" <> T.pack (show $ _loggingConfig_level $ _obelisk_logging c)
204+ ]
205+
198206 myArgs <- liftIO getArgs
199207 --TODO: We'd like to actually use the parser to determine whether to hand off,
200208 --but in the case where this implementation of 'ob' doesn't support all
@@ -210,7 +218,7 @@ main' = do
210218 Nothing -> go as -- If not in a project, just run ourselves
211219 Just impl -> do
212220 -- 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
214222 liftIO $ executeFile impl False ("--no-handoff" : myArgs) Nothing
215223 case myArgs of
216224 "--no-handoff" : as -> go as -- If we've been told not to hand off, don't hand off