hls-plugin-api-2.5.0.0: Haskell Language Server API for plugin communication
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Instances

Instances details
Bounded Priority Source # 
Instance details

Defined in Ide.Logger

Enum Priority Source # 
Instance details

Defined in Ide.Logger

Read Priority Source # 
Instance details

Defined in Ide.Logger

Show Priority Source # 
Instance details

Defined in Ide.Logger

Eq Priority Source # 
Instance details

Defined in Ide.Logger

Ord Priority Source # 
Instance details

Defined in Ide.Logger

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
Monoid Logger Source # 
Instance details

Defined in Ide.Logger

Semigroup Logger Source # 
Instance details

Defined in Ide.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 Ide.Logger

Methods

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

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

Monoid (Recorder msg) Source # 
Instance details

Defined in Ide.Logger

Methods

mempty :: Recorder msg #

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

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

Semigroup (Recorder msg) Source # 
Instance details

Defined in Ide.Logger

Methods

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

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

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

data WithPriority a Source #

Constructors

WithPriority 

Instances

Instances details
Functor WithPriority Source # 
Instance details

Defined in Ide.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 #

withFileRecorder Source #

Arguments

:: MonadUnliftIO m 
=> FilePath

Log file path.

-> Maybe [LoggingColumn]

logging columns to display. Nothing uses defaultLoggingColumns

-> (Either IOException (Recorder (WithPriority (Doc d))) -> m a)

action given a recorder, or the exception if we failed to open the file

-> m a 

makeDefaultHandleRecorder Source #

Arguments

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

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.