HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleghc-lib-parser-9.14.1.20251220GHC2021

GHC.Utils.Logger

Logger

The Logger is an configurable entity that is used by the compiler to output messages on the console (stdout, stderr) and in dump files.

The behaviour of default Logger returned by initLogger can be modified with hooks. The compiler itself uses hooks in multithreaded code (--make) and it is also probably used by ghc-api users (IDEs, etc.).

In addition to hooks, the Logger supports LogFlags: basically a subset of the command-line flags that control the logger behaviour at a higher level than hooks.

  1. Hooks are used to define how to generate a infowarningerror/dump messages

  2. LogFlags are used to decide when and how to generate messages

  • 7 types
  • 2 classes
  • 39 values
classclass HasLogger (m :: Type -> Type) where
#

Methods

Instances6HasLogger
  • HasLogger CoreMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.Opt.Monad
  • HasLogger SimplMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.Opt.Simplify.Monad
  • HasLogger HscDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Env.Types
  • HasLogger GhcDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Monad
  • MonadIO m => HasLogger (GhcT m)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Monad
  • ContainsLogger env => HasLogger (IOEnv env)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Data.IOEnv

Logger setup

6 declarations
datadata DumpFormat
#

Format of a dump

Dump formats are loosely defined: dumps may contain various additional headers and annotations and they may be partial. DumpFormat is mainly a hint (e.g. for syntax highlighters).

Constructors

Instances2Eq, Show
  • Eq DumpFormatDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Logger
  • Show DumpFormatDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Logger

Hooks

Flags

datadata LogFlags
#

Logger flags

Constructors

Logging

9 declarations
valuedefaultLogActionWithHandles
  1. :: Handle

    Handle for standard output

  2. -> Handle

    Handle for standard errors

  3. -> LogAction
#

The default LogAction parametrized over the standard output and standard error handles. Allows clients to replicate the log message formatting of GHC with custom handles.

Dumping

7 declarations

Tracing

5 declarations