-
Notifications
You must be signed in to change notification settings - Fork 214
Conversation
I now makes use of a blend of Control.Monad.Logger and Control.Logging, in that it uses the monad logger log formatting functions, which includes using TH for a location, and the Control.Logging IORef process, so logging is available in any thread that has access to IO. At the moment it has the same flushing behaviour as before.
, haskell-ide-engine | ||
, hie-ghc-mod | ||
, hie-hare | ||
, hie-plugin-api | ||
, hspec | ||
, logging | ||
, fast-logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate of line 111?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops
setLogTimeFormat :: String -> IO () | ||
setLogTimeFormat = atomicWriteIORef logTimeFormat | ||
|
||
-- | This function, or 'withStderrLogging', must be wrapped around whatever |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While perhaps it's clear from the type, it might be good to mention in the docs that these modify global state. So, if you Control.Concurrent.Async.race (withStdoutLogging (logm "a")) (withFileLogging "log" (logm "b"))
, it's not deterministic which messages go to which logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, because you should only ever run one of the withXXXLogging
functions. Perhaps that should be documented to.
LGTM! I once did something similar, but it also associated the log info with threads (how to log, log level, etc). This lets you selectively log different portions of the process. There's certainly a case to be made that thread-local storage is inadvisable, but it certainly would be cool for things like this. Lets keep it simple till we really find the need to do something more specialized. |
Updated logging to remove PCRE dependency
It now makes use of a blend of Control.Monad.Logger and Control.Logging,
in that it uses the monad logger log formatting functions, which
includes using TH for a location, and the Control.Logging IORef process,
so logging is available in any thread that has access to IO.
At the moment it has the same flushing behaviour as before.
Closes #112
cc @bergey