Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Logger
Synopsis
- data Logger
- initLogger :: IO Logger
- class HasLogger m where
- class ContainsLogger t where
- extractLogger :: t -> Logger
- type LogAction = DynFlags -> WarnReason -> Severity -> SrcSpan -> SDoc -> IO ()
- type DumpAction = DynFlags -> PprStyle -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
- type TraceAction a = DynFlags -> String -> SDoc -> a -> a
- data DumpFormat
- putLogMsg :: Logger -> LogAction
- putDumpMsg :: Logger -> DumpAction
- putTraceMsg :: Logger -> TraceAction a
- popLogHook :: Logger -> Logger
- pushLogHook :: (LogAction -> LogAction) -> Logger -> Logger
- popDumpHook :: Logger -> Logger
- pushDumpHook :: (DumpAction -> DumpAction) -> Logger -> Logger
- popTraceHook :: Logger -> Logger
- pushTraceHook :: (forall a. TraceAction a -> TraceAction a) -> Logger -> Logger
- makeThreadSafe :: Logger -> IO Logger
- jsonLogAction :: LogAction
- defaultLogAction :: LogAction
- defaultLogActionHPrintDoc :: DynFlags -> Bool -> Handle -> SDoc -> IO ()
- defaultLogActionHPutStrDoc :: DynFlags -> Bool -> Handle -> SDoc -> IO ()
- defaultDumpAction :: DumpCache -> LogAction -> DumpAction
- withDumpFileHandle :: DumpCache -> DynFlags -> DumpFlag -> (Maybe Handle -> IO ()) -> IO ()
- touchDumpFile :: Logger -> DynFlags -> DumpFlag -> IO ()
- dumpIfSet :: Logger -> DynFlags -> Bool -> String -> SDoc -> IO ()
- dumpIfSet_dyn :: Logger -> DynFlags -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
- dumpIfSet_dyn_printer :: PrintUnqualified -> Logger -> DynFlags -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
- defaultTraceAction :: TraceAction a
Documentation
initLogger :: IO Logger Source #
class ContainsLogger t where Source #
extractLogger :: t -> Logger Source #
Instances
ContainsLogger (Env gbl lcl) # | |
Defined in GHC.Tc.Types extractLogger :: Env gbl lcl -> Logger Source # |
type DumpAction = DynFlags -> PprStyle -> DumpFlag -> String -> DumpFormat -> SDoc -> IO () Source #
data DumpFormat Source #
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).
FormatHaskell | Haskell |
FormatCore | Core |
FormatSTG | STG |
FormatByteCode | ByteCode |
FormatCMM | Cmm |
FormatASM | Assembly code |
FormatC | C code/header |
FormatLLVM | LLVM bytecode |
FormatText | Unstructured dump |
Instances
Show DumpFormat # | |
Defined in GHC.Utils.Logger | |
Eq DumpFormat # | |
Defined in GHC.Utils.Logger (==) :: DumpFormat -> DumpFormat -> Bool # (/=) :: DumpFormat -> DumpFormat -> Bool # |
putDumpMsg :: Logger -> DumpAction Source #
Dump something
putTraceMsg :: Logger -> TraceAction a Source #
Trace something
Hooks
popLogHook :: Logger -> Logger Source #
Pop a log hook
popDumpHook :: Logger -> Logger Source #
Pop a dump hook
pushDumpHook :: (DumpAction -> DumpAction) -> Logger -> Logger Source #
Push a dump hook
popTraceHook :: Logger -> Logger Source #
Pop a trace hook
pushTraceHook :: (forall a. TraceAction a -> TraceAction a) -> Logger -> Logger Source #
Push a trace hook
Logging
defaultLogActionHPrintDoc :: DynFlags -> Bool -> Handle -> SDoc -> IO () Source #
Like defaultLogActionHPutStrDoc
but appends an extra newline.
defaultLogActionHPutStrDoc :: DynFlags -> Bool -> Handle -> SDoc -> IO () Source #
The boolean arguments let's the pretty printer know if it can optimize indent by writing ascii ' ' characters without going through decoding.
Dumping
defaultDumpAction :: DumpCache -> LogAction -> DumpAction Source #
Default action for dumpAction
hook
withDumpFileHandle :: DumpCache -> DynFlags -> DumpFlag -> (Maybe Handle -> IO ()) -> IO () Source #
touchDumpFile :: Logger -> DynFlags -> DumpFlag -> IO () Source #
Ensure that a dump file is created even if it stays empty
dumpIfSet_dyn :: Logger -> DynFlags -> DumpFlag -> String -> DumpFormat -> SDoc -> IO () Source #
A wrapper around dumpAction
.
First check whether the dump flag is set
Do nothing if it is unset
dumpIfSet_dyn_printer :: PrintUnqualified -> Logger -> DynFlags -> DumpFlag -> String -> DumpFormat -> SDoc -> IO () Source #
A wrapper around putDumpMsg
.
First check whether the dump flag is set
Do nothing if it is unset
Unlike dumpIfSet_dyn
, has a printer argument
Tracing
defaultTraceAction :: TraceAction a Source #
Default action for traceAction
hook