mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-04 13:19:48 +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 Urbit.Prelude
|
||||||
|
|
||||||
import System.Directory ( createDirectoryIfMissing
|
import System.Directory ( createDirectoryIfMissing
|
||||||
, getAppUserDataDirectory
|
, getXdgDirectory
|
||||||
|
, XdgDirectory(XdgCache)
|
||||||
)
|
)
|
||||||
import System.Posix.Internals (c_getpid)
|
import System.Posix.Internals (c_getpid)
|
||||||
import System.Posix.Types (CPid(..))
|
import System.Posix.Types (CPid(..))
|
||||||
@ -83,7 +84,6 @@ runKingEnvStderr verb lvl inner = do
|
|||||||
<&> setLogUseTime True
|
<&> setLogUseTime True
|
||||||
<&> setLogUseLoc False
|
<&> setLogUseLoc False
|
||||||
<&> setLogMinLevel lvl
|
<&> setLogMinLevel lvl
|
||||||
|
|
||||||
withLogFunc logOptions $ \logFunc -> runKingEnv logFunc logFunc inner
|
withLogFunc logOptions $ \logFunc -> runKingEnv logFunc logFunc inner
|
||||||
|
|
||||||
runKingEnvLogFile :: Bool -> LogLevel -> Maybe FilePath -> RIO KingEnv a -> IO a
|
runKingEnvLogFile :: Bool -> LogLevel -> Maybe FilePath -> RIO KingEnv a -> IO a
|
||||||
@ -102,7 +102,6 @@ runKingEnvLogFile verb lvl fileM inner = do
|
|||||||
<&> setLogUseTime False
|
<&> setLogUseTime False
|
||||||
<&> setLogUseLoc False
|
<&> setLogUseLoc False
|
||||||
<&> setLogMinLevel lvl
|
<&> setLogMinLevel lvl
|
||||||
|
|
||||||
withLogFunc stderrLogOptions $ \stderrLogFunc -> withLogFunc logOptions
|
withLogFunc stderrLogOptions $ \stderrLogFunc -> withLogFunc logOptions
|
||||||
$ \logFunc -> runKingEnv logFunc stderrLogFunc inner
|
$ \logFunc -> runKingEnv logFunc stderrLogFunc inner
|
||||||
|
|
||||||
@ -114,7 +113,7 @@ withLogFileHandle f act =
|
|||||||
|
|
||||||
defaultLogFile :: IO FilePath
|
defaultLogFile :: IO FilePath
|
||||||
defaultLogFile = do
|
defaultLogFile = do
|
||||||
logDir <- getAppUserDataDirectory "urbit"
|
logDir <- getXdgDirectory XdgCache "urbit"
|
||||||
createDirectoryIfMissing True logDir
|
createDirectoryIfMissing True logDir
|
||||||
pure (logDir </> "king.log")
|
pure (logDir </> "king.log")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user