Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This is a compatibility module that abstracts over the concrete choice of logging framework so users can plug in whatever framework they want to.
Synopsis
- data Priority
- newtype Recorder msg = Recorder {}
- data WithPriority a = WithPriority {
- priority :: Priority
- callStack_ :: CallStack
- payload :: a
- logWith :: (HasCallStack, MonadIO m) => Recorder (WithPriority msg) -> Priority -> msg -> m ()
- cmap :: (a -> b) -> Recorder b -> Recorder a
- cmapIO :: (a -> IO b) -> Recorder b -> Recorder a
- cfilter :: (a -> Bool) -> Recorder a -> Recorder a
- withFileRecorder :: MonadUnliftIO m => FilePath -> Maybe [LoggingColumn] -> (Either IOException (Recorder (WithPriority (Doc d))) -> m a) -> m a
- makeDefaultStderrRecorder :: MonadIO m => Maybe [LoggingColumn] -> m (Recorder (WithPriority (Doc a)))
- makeDefaultHandleRecorder :: MonadIO m => Maybe [LoggingColumn] -> Lock -> Handle -> m (Recorder (WithPriority (Doc a)))
- data LoggingColumn
- cmapWithPrio :: (a -> b) -> Recorder (WithPriority b) -> Recorder (WithPriority a)
- withBacklog :: (v -> Recorder a) -> IO (Recorder a, v -> IO ())
- lspClientMessageRecorder :: LanguageContextEnv config -> Recorder (WithPriority Text)
- lspClientLogRecorder :: LanguageContextEnv config -> Recorder (WithPriority Text)
- module Prettyprinter
- renderStrict :: SimpleDocStream ann -> Text
- toCologActionWithPrio :: (MonadIO m, HasCallStack) => Recorder (WithPriority msg) -> LogAction m (WithSeverity msg)
- defaultLoggingColumns :: [LoggingColumn]
Documentation
Debug | Verbose debug logging. |
Info | Useful information in case an error has to be understood. |
Warning | These error messages should not occur in a expected usage, and should be investigated. |
Error | Such log messages must never occur in expected usage. |
Instances
Bounded Priority Source # | |
Enum Priority Source # | |
Read Priority Source # | |
Show Priority Source # | |
Eq Priority Source # | |
Ord Priority Source # | |
Note that this is logging actions _of the program_, not of the user. You shouldn't call warning/error if the user has caused an error, only if our code has gone wrong and is itself erroneous (e.g. we threw an exception).
data WithPriority a Source #
WithPriority | |
|
Instances
Functor WithPriority Source # | |
Defined in Ide.Logger fmap :: (a -> b) -> WithPriority a -> WithPriority b # (<$) :: a -> WithPriority b -> WithPriority a # |
logWith :: (HasCallStack, MonadIO m) => Recorder (WithPriority msg) -> Priority -> msg -> m () Source #
:: MonadUnliftIO m | |
=> FilePath | Log file path. |
-> Maybe [LoggingColumn] | logging columns to display. |
-> (Either IOException (Recorder (WithPriority (Doc d))) -> m a) | action given a recorder, or the exception if we failed to open the file |
-> m a |
makeDefaultStderrRecorder :: MonadIO m => Maybe [LoggingColumn] -> m (Recorder (WithPriority (Doc a))) Source #
makeDefaultHandleRecorder Source #
:: MonadIO m | |
=> Maybe [LoggingColumn] | built-in logging columns to display. Nothing uses the default |
-> Lock | lock to take when outputting to handle |
-> Handle | handle to output to |
-> m (Recorder (WithPriority (Doc a))) |
cmapWithPrio :: (a -> b) -> Recorder (WithPriority b) -> Recorder (WithPriority a) Source #
lspClientMessageRecorder :: LanguageContextEnv config -> Recorder (WithPriority Text) Source #
Creates a recorder that sends logs to the LSP client via window/showMessage
notifications.
lspClientLogRecorder :: LanguageContextEnv config -> Recorder (WithPriority Text) Source #
Creates a recorder that sends logs to the LSP client via window/logMessage
notifications.
module Prettyprinter
renderStrict :: SimpleDocStream ann -> Text #
(
takes the output renderStrict
sdoc)sdoc
from a rendering function
and transforms it to strict text.
toCologActionWithPrio :: (MonadIO m, HasCallStack) => Recorder (WithPriority msg) -> LogAction m (WithSeverity msg) Source #