| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Development.IDE.Types.Logger
Description
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 Logger = Logger {
- logPriority :: Priority -> Text -> IO ()
- newtype Recorder msg = Recorder {}
- logError :: Logger -> Text -> IO ()
- logWarning :: Logger -> Text -> IO ()
- logInfo :: Logger -> Text -> IO ()
- logDebug :: Logger -> Text -> IO ()
- noLogging :: Logger
- 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
- withDefaultRecorder :: MonadUnliftIO m => Maybe FilePath -> Maybe [LoggingColumn] -> Priority -> (Recorder (WithPriority (Doc d)) -> m a) -> m a
- makeDefaultStderrRecorder :: MonadIO m => Maybe [LoggingColumn] -> Priority -> m (Recorder (WithPriority (Doc a)))
- priorityToHsLoggerPriority :: Priority -> Priority
- 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
Documentation
Constructors
| 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 # | |
Defined in Development.IDE.Types.Logger | |
| Eq Priority Source # | |
| Ord Priority Source # | |
Defined in Development.IDE.Types.Logger | |
| Show 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).
Constructors
| Logger | |
Fields
| |
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 #
Constructors
| WithPriority | |
Fields
| |
Instances
| Functor WithPriority Source # | |
Defined in Development.IDE.Types.Logger Methods fmap :: (a -> b) -> WithPriority a -> WithPriority b # (<$) :: a -> WithPriority b -> WithPriority a # | |
logWith :: (HasCallStack, MonadIO m) => Recorder (WithPriority msg) -> Priority -> msg -> m () Source #
Arguments
| :: MonadUnliftIO m | |
| => Maybe FilePath | Log file path. |
| -> Maybe [LoggingColumn] | logging columns to display. |
| -> Priority | min priority for hslogger compatibility |
| -> (Recorder (WithPriority (Doc d)) -> m a) | action given a recorder |
| -> m a |
If no path given then use stderr, otherwise use file.
Kinda complicated because we also need to setup hslogger for
`hie-bios` log compatibility reasons. If `hie-bios` can be set to use our
logger instead or if `hie-bios` doesn't use hslogger then hslogger can
be removed completely. See setupHsLogger comment.
makeDefaultStderrRecorder :: MonadIO m => Maybe [LoggingColumn] -> Priority -> m (Recorder (WithPriority (Doc a))) Source #
Priority is actually for hslogger compatibility
data LoggingColumn Source #
Constructors
| TimeColumn | |
| ThreadIdColumn | |
| PriorityColumn | |
| DataColumn | |
| SourceLocColumn |
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.