ghcide-1.7.0.0: The core of an IDE
Safe HaskellNone
LanguageHaskell2010

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

Documentation

data Priority Source #

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.

newtype Logger 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

Instances

Instances details
Semigroup Logger Source # 
Instance details

Defined in Development.IDE.Types.Logger

Monoid Logger Source # 
Instance details

Defined in Development.IDE.Types.Logger

newtype Recorder msg 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

Recorder 

Fields

Instances

Instances details
Contravariant Recorder Source # 
Instance details

Defined in Development.IDE.Types.Logger

Methods

contramap :: (a -> b) -> Recorder b -> Recorder a #

(>$) :: b -> Recorder b -> Recorder a #

Semigroup (Recorder msg) Source # 
Instance details

Defined in Development.IDE.Types.Logger

Methods

(<>) :: Recorder msg -> Recorder msg -> Recorder msg #

sconcat :: NonEmpty (Recorder msg) -> Recorder msg #

stimes :: Integral b => b -> Recorder msg -> Recorder msg #

Monoid (Recorder msg) Source # 
Instance details

Defined in Development.IDE.Types.Logger

Methods

mempty :: Recorder msg #

mappend :: Recorder msg -> Recorder msg -> Recorder msg #

mconcat :: [Recorder msg] -> Recorder msg #

data WithPriority a Source #

Constructors

WithPriority 

Instances

Instances details
Functor WithPriority Source # 
Instance details

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 #

cmap :: (a -> b) -> Recorder b -> Recorder a Source #

cmapIO :: (a -> IO b) -> Recorder b -> Recorder a Source #

cfilter :: (a -> Bool) -> Recorder a -> Recorder a Source #

withDefaultRecorder Source #

Arguments

:: MonadUnliftIO m 
=> Maybe FilePath

Log file path. Nothing uses stderr

-> Maybe [LoggingColumn]

logging columns to display. Nothing uses defaultLoggingColumns

-> 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

withBacklog :: (v -> Recorder a) -> IO (Recorder a, v -> IO ()) Source #

Given a Recorder that requires an argument, produces a Recorder that queues up messages until the argument is provided using the callback, at which point it sends the backlog and begins functioning normally.

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.

renderStrict :: SimpleDocStream ann -> Text #

(renderStrict sdoc) takes the output sdoc from a rendering function and transforms it to strict text.