Safe Haskell | None |
---|
Import this module qualified! All code examples assume you have imported the module as follows:
import qualified IHP.Log as Log
Synopsis
- module IHP.Log.Types
- debug :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO ()
- info :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO ()
- warn :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO ()
- error :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO ()
- fatal :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO ()
- unknown :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO ()
- makeRequestLogger :: RequestLoggerSettings -> Logger -> IO Middleware
- defaultRequestLogger :: Logger -> IO Middleware
Documentation
module IHP.Log.Types
debug :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO () Source #
Log a debug level message.
action CreateUserAction { .. } = do Log.debug "entered CreateUserAction" ...
info :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO () Source #
Log an info level message.
action UsersAction = do users <- query @User |> fetch Log.info $ show (lengh users) <> " users fetched." ...
warn :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO () Source #
Log a warning level message.
action UsersAction = do users <- query @User |> fetch whenEmpty users $ Log.warn "No users found. Something might be wrong!" ...
error :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO () Source #
Log a warning level message.
action CreatePostAction = do let post = newRecord @Post post |> buildPost |> ifValid case Left post -> do Log.error "Invalid post." render NewView { .. } Right post -> do post post | createRecord setSuccessMessage "Post created" redirectTo PostsAction
fatal :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO () Source #
Log a fatal level message. Note this does not exit the program for you -- it only logs to the Fatal log level.
Log.fatal "Unrecoverable application error!"
unknown :: (?context :: context, LoggingProvider context, ToLogStr string) => string -> IO () Source #
Log an "unknown" level message. This is the highest log level and will always be output by the logger.
Log.unknown "This will be sent to the logger no matter what!"
makeRequestLogger :: RequestLoggerSettings -> Logger -> IO Middleware Source #
Wraps RequestLogger
from wai-extra to log to an IHP logger.
See RequestLogger
.
defaultRequestLogger :: Logger -> IO Middleware Source #
Create a request logger with default settings wrapped in an IHP logger.
See RequestLogger
.