module Language.Rzk.VSCode.Logging where

import           Colog.Core           (Severity (..), WithSeverity (..), (<&))
import qualified Data.Text            as T
import           Language.LSP.Logging (defaultClientLogger)
import           Language.LSP.Server  (MonadLsp)


logDebug :: MonadLsp c m => String -> m ()
logDebug :: forall c (m :: * -> *). MonadLsp c m => String -> m ()
logDebug String
msg = LogAction m (WithSeverity Text)
forall c (m :: * -> *).
MonadLsp c m =>
LogAction m (WithSeverity Text)
defaultClientLogger LogAction m (WithSeverity Text) -> WithSeverity Text -> m ()
forall (m :: * -> *) msg. LogAction m msg -> msg -> m ()
<& String -> Text
T.pack String
msg Text -> Severity -> WithSeverity Text
forall msg. msg -> Severity -> WithSeverity msg
`WithSeverity` Severity
Debug

logInfo :: MonadLsp c m => String -> m ()
logInfo :: forall c (m :: * -> *). MonadLsp c m => String -> m ()
logInfo String
msg = LogAction m (WithSeverity Text)
forall c (m :: * -> *).
MonadLsp c m =>
LogAction m (WithSeverity Text)
defaultClientLogger LogAction m (WithSeverity Text) -> WithSeverity Text -> m ()
forall (m :: * -> *) msg. LogAction m msg -> msg -> m ()
<& String -> Text
T.pack String
msg Text -> Severity -> WithSeverity Text
forall msg. msg -> Severity -> WithSeverity msg
`WithSeverity` Severity
Info

logWarning :: MonadLsp c m => String -> m ()
logWarning :: forall c (m :: * -> *). MonadLsp c m => String -> m ()
logWarning String
msg = LogAction m (WithSeverity Text)
forall c (m :: * -> *).
MonadLsp c m =>
LogAction m (WithSeverity Text)
defaultClientLogger LogAction m (WithSeverity Text) -> WithSeverity Text -> m ()
forall (m :: * -> *) msg. LogAction m msg -> msg -> m ()
<& String -> Text
T.pack String
msg Text -> Severity -> WithSeverity Text
forall msg. msg -> Severity -> WithSeverity msg
`WithSeverity` Severity
Warning

-- | Error logs will also be shown to the user via `window/showMessage`
logError :: MonadLsp c m => String -> m ()
logError :: forall c (m :: * -> *). MonadLsp c m => String -> m ()
logError String
msg = LogAction m (WithSeverity Text)
forall c (m :: * -> *).
MonadLsp c m =>
LogAction m (WithSeverity Text)
defaultClientLogger LogAction m (WithSeverity Text) -> WithSeverity Text -> m ()
forall (m :: * -> *) msg. LogAction m msg -> msg -> m ()
<& String -> Text
T.pack String
msg Text -> Severity -> WithSeverity Text
forall msg. msg -> Severity -> WithSeverity msg
`WithSeverity` Severity
Error