Skip to content

Commit b23794a

Browse files
committed
Switch to CallStack logging commercialhaskell#3373
1 parent 89d34af commit b23794a

50 files changed

Lines changed: 462 additions & 530 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@ cache:
1919
matrix:
2020
fast_finish: true
2121
include:
22-
- env: BUILD=cabal STACK_YAML=stack-7.10.yaml CABALVER=1.24 GHCVER=7.10.3
23-
compiler: ": #GHC 7.10.3"
24-
addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}}
25-
26-
- env: BUILD=stack STACK_YAML=stack-7.10.yaml
27-
compiler: ": #stack 7.10.3"
28-
addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
29-
30-
- env: BUILD=stack STACK_YAML=stack-7.10.yaml
31-
compiler: ": #stack 7.10.3 osx"
32-
os: osx
33-
3422
- env: BUILD=cabal STACK_YAML=stack.yaml CABALVER=1.24 GHCVER=8.0.2
3523
compiler: ": #GHC 8.0.2"
3624
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}}
@@ -48,10 +36,6 @@ matrix:
4836
addons: {apt: {packages: [ghc-8.0.2], sources: [hvr-ghc]}}
4937

5038
allow_failures:
51-
- env: BUILD=stack STACK_YAML=stack-7.10.yaml
52-
compiler: ": #stack 7.10.3 osx"
53-
os: osx
54-
5539
- env: BUILD=stack GHCVER=8.0.2 STACK_YAML=stack.yaml
5640
compiler: ": #stack 8.0.2 osx"
5741
os: osx

src/Data/Aeson/Extended.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ logJSONWarnings
105105
:: MonadLogger m
106106
=> FilePath -> [JSONWarning] -> m ()
107107
logJSONWarnings fp =
108-
mapM_ (\w -> $logWarn ("Warning: " <> T.pack fp <> ": " <> T.pack (show w)))
108+
mapM_ (\w -> logWarn ("Warning: " <> T.pack fp <> ": " <> T.pack (show w)))
109109

110110
-- | Handle warnings in a sub-object.
111111
jsonSubWarnings :: WarningParser (WithJSONWarnings a) -> WarningParser a

src/Data/Store/VersionTagged.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ storeEncodeFile :: (Store a, MonadIO m, MonadLogger m, Eq a)
4545
-> m ()
4646
storeEncodeFile pokeFunc peekFunc fp x = do
4747
let fpt = T.pack (toFilePath fp)
48-
$logDebug $ "Encoding " <> fpt
48+
logDebug $ "Encoding " <> fpt
4949
ensureDir (parent fp)
5050
let (sz, poker) = pokeFunc x
5151
encoded = unsafeEncodeWith poker sz
5252
assert (decodeExWith peekFunc encoded == x) $ liftIO $ BS.writeFile (toFilePath fp) encoded
53-
$logDebug $ "Finished writing " <> fpt
53+
logDebug $ "Finished writing " <> fpt
5454

5555
-- | Read from the given file. If the read fails, run the given action and
5656
-- write that back to the file. Always starts the file off with the
@@ -63,14 +63,14 @@ versionedDecodeOrLoadImpl :: (Store a, Eq a, MonadUnliftIO m, MonadLogger m)
6363
-> m a
6464
versionedDecodeOrLoadImpl pokeFunc peekFunc fp mx = do
6565
let fpt = T.pack (toFilePath fp)
66-
$logDebug $ "Trying to decode " <> fpt
66+
logDebug $ "Trying to decode " <> fpt
6767
mres <- versionedDecodeFileImpl peekFunc fp
6868
case mres of
6969
Just x -> do
70-
$logDebug $ "Success decoding " <> fpt
70+
logDebug $ "Success decoding " <> fpt
7171
return x
7272
_ -> do
73-
$logDebug $ "Failure decoding " <> fpt
73+
logDebug $ "Failure decoding " <> fpt
7474
x <- mx
7575
storeEncodeFile pokeFunc peekFunc fp x
7676
return x
@@ -81,14 +81,14 @@ versionedDecodeFileImpl :: (Store a, MonadUnliftIO m, MonadLogger m)
8181
-> m (Maybe a)
8282
versionedDecodeFileImpl peekFunc fp = do
8383
mbs <- liftIO (Just <$> BS.readFile (toFilePath fp)) `catch` \(err :: IOException) -> do
84-
$logDebug ("Exception ignored when attempting to load " <> T.pack (toFilePath fp) <> ": " <> T.pack (show err))
84+
logDebug ("Exception ignored when attempting to load " <> T.pack (toFilePath fp) <> ": " <> T.pack (show err))
8585
return Nothing
8686
case mbs of
8787
Nothing -> return Nothing
8888
Just bs ->
8989
liftIO (Just <$> decodeIOWith peekFunc bs) `catch` \(err :: PeekException) -> do
9090
let fpt = T.pack (toFilePath fp)
91-
$logDebug ("Error while decoding " <> fpt <> ": " <> T.pack (show err) <> " (this might not be an error, when switching between stack versions)")
91+
logDebug ("Error while decoding " <> fpt <> ": " <> T.pack (show err) <> " (this might not be an error, when switching between stack versions)")
9292
return Nothing
9393

9494
storeVersionConfig :: String -> String -> VersionConfig a

src/Network/HTTP/Download.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ redownload :: (MonadIO m, MonadLogger m)
6565
-> Path Abs File -- ^ destination
6666
-> m Bool
6767
redownload req0 dest = do
68-
$logDebug $ "Downloading " <> decodeUtf8With lenientDecode (path req0)
68+
logDebug $ "Downloading " <> decodeUtf8With lenientDecode (path req0)
6969
let destFilePath = toFilePath dest
7070
etagFilePath = destFilePath <.> "etag"
7171

src/Network/HTTP/Download/Verified.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ verifiedDownload :: (MonadIO m, MonadLogger m)
225225
verifiedDownload DownloadRequest{..} destpath progressSink = do
226226
let req = drRequest
227227
whenM' (liftIO getShouldDownload) $ do
228-
$logDebug $ "Downloading " <> decodeUtf8With lenientDecode (path req)
228+
logDebug $ "Downloading " <> decodeUtf8With lenientDecode (path req)
229229
liftIO $ do
230230
createDirectoryIfMissing True dir
231231
recoveringHttp drRetryPolicy $

src/Path/CheckInstall.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,31 @@ warnInstallSearchPathIssues destDir installed = do
2626
Just exePath -> do
2727
exeDir <- (liftIO . fmap FP.takeDirectory . D.canonicalizePath) exePath
2828
unless (exeDir `FP.equalFilePath` destDir) $ do
29-
$logWarn ""
30-
$logWarn $ T.concat
29+
logWarn ""
30+
logWarn $ T.concat
3131
[ "WARNING: The \""
3232
, exe
3333
, "\" executable found on the PATH environment variable is "
3434
, T.pack exePath
3535
, ", and not the version that was just installed."
3636
]
37-
$logWarn $ T.concat
37+
logWarn $ T.concat
3838
[ "This means that \""
3939
, exe
4040
, "\" calls on the command line will not use this version."
4141
]
4242
Nothing -> do
43-
$logWarn ""
44-
$logWarn $ T.concat
43+
logWarn ""
44+
logWarn $ T.concat
4545
[ "WARNING: Installation path "
4646
, T.pack destDir
4747
, " is on the PATH but the \""
4848
, exe
4949
, "\" executable that was just installed could not be found on the PATH."
5050
]
5151
else do
52-
$logWarn ""
53-
$logWarn $ T.concat
52+
logWarn ""
53+
logWarn $ T.concat
5454
[ "WARNING: Installation path "
5555
, T.pack destDir
5656
, " not found on the PATH environment variable"

src/Stack/Build.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ build setLocalFiles mbuildLk boptsCli = fixCodePage $ do
117117
-- NOTE: This policy is too conservative. In the future we should be able to
118118
-- schedule unlocking as an Action that happens after all non-local actions are
119119
-- complete.
120-
(Just lk,True) -> do $logDebug "All installs are local; releasing snapshot lock early."
120+
(Just lk,True) -> do logDebug "All installs are local; releasing snapshot lock early."
121121
liftIO $ unlockFile lk
122122
_ -> return ()
123123

@@ -174,7 +174,7 @@ instance Exception CabalVersionException
174174
warnIfExecutablesWithSameNameCouldBeOverwritten
175175
:: MonadLogger m => [LocalPackage] -> Plan -> m ()
176176
warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do
177-
$logDebug "Checking if we are going to build multiple executables with the same name"
177+
logDebug "Checking if we are going to build multiple executables with the same name"
178178
forM_ (Map.toList warnings) $ \(exe,(toBuild,otherLocals)) -> do
179179
let exe_s
180180
| length toBuild > 1 = "several executables with the same name:"
@@ -183,7 +183,7 @@ warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do
183183
T.intercalate
184184
", "
185185
["'" <> packageNameText p <> ":" <> exe <> "'" | p <- pkgs]
186-
($logWarn . T.unlines . concat)
186+
(logWarn . T.unlines . concat)
187187
[ [ "Building " <> exe_s <> " " <> exesText toBuild <> "." ]
188188
, [ "Only one of them will be available via 'stack exec' or locally installed."
189189
| length toBuild > 1
@@ -241,7 +241,7 @@ warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do
241241

242242
warnAboutSplitObjs :: MonadLogger m => BuildOpts -> m ()
243243
warnAboutSplitObjs bopts | boptsSplitObjs bopts = do
244-
$logWarn $ "Building with --split-objs is enabled. " <> T.pack splitObjsWarning
244+
logWarn $ "Building with --split-objs is enabled. " <> T.pack splitObjsWarning
245245
warnAboutSplitObjs _ = return ()
246246

247247
splitObjsWarning :: String
@@ -344,7 +344,7 @@ fixCodePage inner = do
344344

345345
fixInput $ fixOutput inner
346346
expected = 65001 -- UTF-8
347-
warn typ = $logInfo $ T.concat
347+
warn typ = logInfo $ T.concat
348348
[ "Setting"
349349
, typ
350350
, " codepage to UTF-8 (65001) to ensure correct output from GHC"

src/Stack/Build/ConstructPlan.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ constructPlan :: forall env. HasEnvConfig env
176176
-> Bool
177177
-> RIO env Plan
178178
constructPlan ls0 baseConfigOpts0 locals extraToBuild0 localDumpPkgs loadPackage0 sourceMap installedMap initialBuildSteps = do
179-
$logDebug "Constructing the build plan"
179+
logDebug "Constructing the build plan"
180180
u <- askUnliftIO
181181

182182
econfig <- view envConfigL
@@ -187,7 +187,7 @@ constructPlan ls0 baseConfigOpts0 locals extraToBuild0 localDumpPkgs loadPackage
187187
lp <- getLocalPackages
188188
((), m, W efinals installExes dirtyReason deps warnings parents) <-
189189
liftIO $ runRWST inner (ctx econfig (unliftIO u . getPackageVersions) lp) M.empty
190-
mapM_ $logWarn (warnings [])
190+
mapM_ logWarn (warnings [])
191191
let toEither (_, Left e) = Left e
192192
toEither (k, Right v) = Right (k, v)
193193
(errlibs, adrs) = partitionEithers $ map toEither $ M.toList m

0 commit comments

Comments
 (0)