mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
king: use XDG cache directory for default log location
This commit is contained in:
parent
2d1f3cdfa0
commit
6a236a2749
@ -26,7 +26,8 @@ import Urbit.King.Config
|
||||
import Urbit.Prelude
|
||||
|
||||
import System.Directory ( createDirectoryIfMissing
|
||||
, getAppUserDataDirectory
|
||||
, getXdgDirectory
|
||||
, XdgDirectory(XdgCache)
|
||||
)
|
||||
import System.Posix.Internals (c_getpid)
|
||||
import System.Posix.Types (CPid(..))
|
||||
@ -83,7 +84,6 @@ runKingEnvStderr verb lvl inner = do
|
||||
<&> setLogUseTime True
|
||||
<&> setLogUseLoc False
|
||||
<&> setLogMinLevel lvl
|
||||
|
||||
withLogFunc logOptions $ \logFunc -> runKingEnv logFunc logFunc inner
|
||||
|
||||
runKingEnvLogFile :: Bool -> LogLevel -> Maybe FilePath -> RIO KingEnv a -> IO a
|
||||
@ -102,7 +102,6 @@ runKingEnvLogFile verb lvl fileM inner = do
|
||||
<&> setLogUseTime False
|
||||
<&> setLogUseLoc False
|
||||
<&> setLogMinLevel lvl
|
||||
|
||||
withLogFunc stderrLogOptions $ \stderrLogFunc -> withLogFunc logOptions
|
||||
$ \logFunc -> runKingEnv logFunc stderrLogFunc inner
|
||||
|
||||
@ -114,7 +113,7 @@ withLogFileHandle f act =
|
||||
|
||||
defaultLogFile :: IO FilePath
|
||||
defaultLogFile = do
|
||||
logDir <- getAppUserDataDirectory "urbit"
|
||||
logDir <- getXdgDirectory XdgCache "urbit"
|
||||
createDirectoryIfMissing True logDir
|
||||
pure (logDir </> "king.log")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user