Revert "king: fix zig-zag in stderr logging"

This reverts commit e9ed97f8a8.
This commit is contained in:
Elliot Glaysher 2020-10-15 13:58:41 -04:00
parent 4dda88864d
commit aa8634ecdd

View File

@ -29,7 +29,6 @@ where
import Urbit.King.Config
import Urbit.Prelude
import RIO (logGeneric)
import System.Directory ( createDirectoryIfMissing
, getXdgDirectory
, XdgDirectory(XdgCache)
@ -89,9 +88,7 @@ runKingEnvStderr verb lvl inner = do
<&> setLogUseTime True
<&> setLogUseLoc False
<&> setLogMinLevel lvl
withLogFunc logOptions $ \logFunc ->
let lf = wrapCarriage logFunc
in runKingEnv lf lf inner
withLogFunc logOptions $ \logFunc -> runKingEnv logFunc logFunc inner
runKingEnvLogFile :: Bool -> LogLevel -> Maybe FilePath -> RIO KingEnv a -> IO a
runKingEnvLogFile verb lvl fileM inner = do
@ -110,7 +107,7 @@ runKingEnvLogFile verb lvl fileM inner = do
<&> setLogUseLoc False
<&> setLogMinLevel lvl
withLogFunc stderrLogOptions $ \stderrLogFunc -> withLogFunc logOptions
$ \logFunc -> runKingEnv logFunc (wrapCarriage stderrLogFunc) inner
$ \logFunc -> runKingEnv logFunc stderrLogFunc inner
withLogFileHandle :: FilePath -> (Handle -> IO a) -> IO a
withLogFileHandle f act =
@ -118,11 +115,6 @@ withLogFileHandle f act =
hSetBuffering handle LineBuffering
act handle
-- XX loses callstack
wrapCarriage :: LogFunc -> LogFunc
wrapCarriage lf = mkLogFunc $ \_ ls ll bldr ->
runRIO lf $ logGeneric ls ll (bldr <> "\r")
defaultLogFile :: IO FilePath
defaultLogFile = do
logDir <- getXdgDirectory XdgCache "urbit"