{-# LANGUAGE CPP #-}
module Development.IDE.GHC.Compat.Logger (
putLogHook,
Logger.pushLogHook,
LogActionCompat,
logActionCompat,
defaultLogActionHPutStrDoc,
) where
import Development.IDE.GHC.Compat.Core
import Development.IDE.GHC.Compat.Env as Env
import Development.IDE.GHC.Compat.Outputable
import GHC.Utils.Outputable
import GHC.Utils.Logger as Logger
#if MIN_VERSION_ghc(9,3,0)
import GHC.Types.Error
#endif
putLogHook :: Logger -> HscEnv -> HscEnv
putLogHook :: Logger -> HscEnv -> HscEnv
putLogHook Logger
logger HscEnv
env =
HscEnv
env { hsc_logger :: Logger
hsc_logger = Logger
logger }
#if MIN_VERSION_ghc(9,3,0)
type LogActionCompat = LogFlags -> Maybe DiagnosticReason -> Maybe Severity -> SrcSpan -> PrintUnqualified -> SDoc -> IO ()
logActionCompat :: LogActionCompat -> LogAction
#if MIN_VERSION_ghc(9,7,0)
logActionCompat logAction logFlags (MCDiagnostic severity (ResolvedDiagnosticReason wr) _) loc = logAction logFlags (Just wr) (Just severity) loc alwaysQualify
#elif MIN_VERSION_ghc(9,5,0)
logActionCompat logAction logFlags (MCDiagnostic severity wr _) loc = logAction logFlags (Just wr) (Just severity) loc alwaysQualify
#else
logActionCompat logAction logFlags (MCDiagnostic severity wr) loc = logAction logFlags (Just wr) (Just severity) loc alwaysQualify
#endif
logActionCompat logAction logFlags _cls loc = logAction logFlags Nothing Nothing loc alwaysQualify
#else
type LogActionCompat = DynFlags -> WarnReason -> Severity -> SrcSpan -> PrintUnqualified -> SDoc -> IO ()
logActionCompat :: LogActionCompat -> LogAction
logActionCompat :: LogActionCompat -> LogAction
logActionCompat LogActionCompat
logAction DynFlags
dynFlags WarnReason
wr Severity
severity SrcSpan
loc = LogActionCompat
logAction DynFlags
dynFlags WarnReason
wr Severity
severity SrcSpan
loc PrintUnqualified
alwaysQualify
#endif