HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulehslogger-1.3.2.0Haskell2010

System.Log.Formatter

Definition of log formatter support

A few basic, and extendable formatters are defined.

Please see System.Log.Logger for extensive documentation on the logging system.

  • 1 type
  • 4 values
  • Packagehslogger-1.3.2.0
  • Exports5
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceFormatter.hs
typetype LogFormatter a = a -> LogRecord -> String -> IO String
#

A LogFormatter is used to format log messages. Note that it is paramterized on the Handler to allow the formatter to use information specific to the handler (an example of can be seen in the formatter used in System.Log.Handler.Syslog)

Takes a format string, and returns a formatter that may be used to format log messages. The format string may contain variables prefixed with a $-sign which will be replaced at runtime with corresponding values. The currently supported variables are:

  • $msg - The actual log message

  • $loggername - The name of the logger

  • $prio - The priority level of the message

  • $tid - The thread ID

  • $pid - Process ID (Not available on windows)

  • $time - The current time

  • $utcTime - The current time in UTC Time

valuevarFormatter :: [(String, IO String)] -> String -> LogFormatter a
#

An extensible formatter that allows new substition variables to be defined. Each variable has an associated IO action that is used to produce the string to substitute for the variable name. The predefined variables are the same as for simpleLogFormatter excluding $time and $utcTime.