Conversation
7324698 to
366add1
Compare
| ask = lift ask | ||
| local = mapLogT . local | ||
|
|
||
| -- | Run a 'LogT' computation. |
There was a problem hiding this comment.
Why did you remove the haddock?
There was a problem hiding this comment.
Because I'm stupid 😬
log-base/src/Log/Monad.hs
Outdated
| import Control.Monad.Writer.Class | ||
| import Data.Aeson | ||
| import Data.Text (Text) | ||
| import Data.Text (Text, pack) |
There was a problem hiding this comment.
You don't need pack, aeson handles string conversions itself.
log-base/src/Log/Monad.hs
Outdated
| logAttention "Uncaught exception raised" $ object ["error" .= (pack . show $ e)] | ||
| throwM e | ||
| ExitCaseAbort -> | ||
| logAttention_ "Process was aborted manually" |
There was a problem hiding this comment.
ExitCaseAbort does not mean process was aborted, it means the computation was aborted with means other than runtime exception (like the error from ExceptT if the stack happens to have it).
|
Please check that it logs the exception when cron exits with the exception (and provide associated kontrakcja PR). |
|
You were right to ask, because it doesn't work :( |
|
All right, finally manage to make it work.
|
c84f054 to
c75ec4f
Compare
|
OK, here is a (hopefully) final version using |
Anything that I can help with for that particular issue? |
arybczak
left a comment
There was a problem hiding this comment.
Looks good, thanks 👍
Also needs a version bump to 0.13.0.0 and a changelog entry.
log-base/src/Log/Monad.hs
Outdated
| runLogT component logger maxLogLevel m = runReaderT | ||
| (unLogT $ liftedCatch m (\(SomeException e) -> do | ||
| logAttention "Uncaught exception" $ object ["error" .= show e] | ||
| E.throw e) |
There was a problem hiding this comment.
| E.throw e) | |
| liftBase $ E.throwIO e) |
@theophile-scrive You can add |
|
Please don't merge yet, I'm wondering about this comment. |
Rather than patching runLogT directly, add a composable utility
arybczak
left a comment
There was a problem hiding this comment.
Please fix missing dots at the end of sentences.
log-base/log-base.cabal
Outdated
| cabal-version: 3.0 | ||
| name: log-base | ||
| version: 0.12.0.1 | ||
| version: 0.13.0.0 |
There was a problem hiding this comment.
It can be 0.12.1.0 now since we're not changing runLogT.
log-base/CHANGELOG.md
Outdated
| @@ -1,3 +1,6 @@ | |||
| # log-base-0.13.0.0 (2025-06-23) | |||
There was a problem hiding this comment.
| # log-base-0.13.0.0 (2025-06-23) | |
| # log-base-0.12.1.0 (2025-??-??) |
I'll set the date when a release is made.
log-base/src/Log/Monad.hs
Outdated
| , runLogT | ||
| , mapLogT | ||
| , logMessageIO | ||
| , logExceptions |
There was a problem hiding this comment.
Put it after runLogT on the list so it matches place in the code.
log-base/src/Log/Monad.hs
Outdated
| } -- We can't do synchronisation here, since 'runLogT' can be invoked | ||
| -- quite often from the application (e.g. on every request). | ||
|
|
||
| -- | Unsure uncaught exceptions get logged |
| http-client, | ||
| http-types, | ||
| log-base >= 0.10 && <0.13, | ||
| log-base >= 0.10 && <0.14, |
There was a problem hiding this comment.
Don't need this now (same below).
00ae1a2 to
c8f1072
Compare
|
Applied your suggestions and added the missing dots. |
Ensures that uncaught exception leaves a log, so it's easier to know what happened and debuggers are not left in the dark. Unfortunately, this adds a constraint to the underlying monad.