Moduleghc-9.10.3GHC2021
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.
Hooks are used to define how to generate a infowarningerror/dump messages
LogFlags are used to decide when and how to generate messages
- 7 types
- 2 classes
- 38 values
- Packageghc-9.10.3
- Exports47
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceLogger.hs
Instances8HasLogger, …
HasLogger LlvmMDefined in ghc-9.10.3 · GHC.CmmToLlvm.BaseHasLogger CoreMDefined in ghc-9.10.3 · GHC.Core.Opt.MonadHasLogger SimplMDefined in ghc-9.10.3 · GHC.Core.Opt.Simplify.MonadHasLogger BkpMDefined in ghc-9.10.3 · GHC.Driver.BackpackHasLogger HscDefined in ghc-9.10.3 · GHC.Driver.Env.TypesHasLogger GhcDefined in ghc-9.10.3 · GHC.Driver.MonadMonadIO m => HasLogger (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadContainsLogger env => HasLogger (IOEnv env)Defined in ghc-9.10.3 · GHC.Data.IOEnv
Methods
extractLogger :: t -> Logger
Instances1ContainsLogger
ContainsLogger (Env gbl lcl)Defined in ghc-9.10.3 · GHC.Tc.Types
Logger setup
6 declarationsFormat 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
FormatHaskellHaskell
FormatCoreCore
FormatSTGSTG
FormatByteCodeByteCode
FormatCMMCmm
FormatASMAssembly code
FormatCC code/header
FormatLLVMLLVM bytecode
FormatJSJavaScript code
FormatTextUnstructured dump
Instances2Eq, Show
Eq DumpFormatDefined in ghc-9.10.3 · GHC.Utils.LoggerShow DumpFormatDefined in ghc-9.10.3 · GHC.Utils.Logger
Hooks
Pop a log hook
Push a log hook
Push a json log hook
Pop a dump hook
Push a dump hook
Pop a trace hook
Push a trace hook
Make the logger thread-safe
Flags
Logger flags
Constructors
LogFlagslog_default_user_context :: SDocContextlog_default_dump_context :: SDocContextlog_dump_flags :: !EnumSet DumpFlagDump flags
log_show_caret :: !BoolShow caret in diagnostics
log_diagnostics_as_json :: !BoolFormat diagnostics as JSON
log_show_warn_groups :: !BoolShow warning flag groups
log_enable_timestamps :: !BoolEnable timestamps
log_dump_to_file :: !BoolEnable dump to file
log_dump_dir :: !Maybe FilePathDump directory
log_dump_prefix :: !FilePathNormal dump path ("basename.")
log_dump_prefix_override :: !Maybe FilePathOverriden dump path
log_with_ways :: !BoolUse different dump files names for different ways
log_enable_debug :: !BoolEnable debug output
log_verbosity :: !IntVerbosity level
log_ways :: !Maybe WaysCurrent ways (to name dump files)
Default LogFlags
Test if a DumpFlag is enabled
Enable a DumpFlag
Set LogFlags
Update LogFlags
Logger flags
Test if a DumpFlag is set
Test if verbosity is >= to the given value
Logging
8 declarationsLog something
Like defaultLogActionHPutStrDoc but appends an extra newline.
The boolean arguments let's the pretty printer know if it can optimize indent by writing ascii ' ' characters without going through decoding.
Log something
Log a dump message (not a dump file)
Dumping
7 declarationsDefault action for dumpAction hook
Dump something
Dump if the given DumpFlag is set
Dump if the given DumpFlag is set
Unlike putDumpFileMaybe, has a NamePprCtx argument
Ensure that a dump file is created even if it stays empty
Dump something
Tracing
5 declarationsDefault action for traceAction hook
Trace something
Set the trace flushing function
The currently set trace flushing function is passed to the updating function
Calls the trace flushing function
Log a trace message