-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A super simple logging module. Only for use for very simple projects.
--
-- A super simple logging module. Only for use for very simple projects.
@package micrologger
@version 0.4.0.0
-- | Internal definitions. Do not import directly.
module LuminescentDreams.Logger.Internal
-- | An ordinary hierarchy of logging priorities.
data LogLevel
LogDebug :: LogLevel
LogInfo :: LogLevel
LogWarning :: LogLevel
LogError :: LogLevel
LogEmergency :: LogLevel
-- | The primary data structure to contain a logger of any kind.
data Logger
Logger :: (Text -> IO ()) -> LogLevel -> Logger
-- | Any IO action that accepts the log message
[logCmd_] :: Logger -> (Text -> IO ())
-- | The minimum level at which a log message should be accepted
[lvl_] :: Logger -> LogLevel
-- | Generate standard text representations of a log level. This is useful
-- to the Standard logger but may not be interesting to any others.
instance GHC.Show.Show LuminescentDreams.Logger.Internal.LogLevel
instance GHC.Classes.Ord LuminescentDreams.Logger.Internal.LogLevel
instance GHC.Classes.Eq LuminescentDreams.Logger.Internal.LogLevel
instance Data.Text.Buildable.Buildable LuminescentDreams.Logger.Internal.LogLevel
-- | Generate JSON logs compatible with LogZ.io. logMsgJs and
-- formatMsgJs are both re-exported, so it should not be necessary
-- to import this module directly.
--
-- TODO: Rename this to LogZ since it generates fields specific to that
-- service.
module LuminescentDreams.Logger.JSON
-- | Log a message in LogZ format. This uses formatMsgJs to generate
-- the actual format string.
logMsgJs :: Logger -> LogLevel -> [(String, Value)] -> IO ()
-- | Format a message for LogZ JSON format.
formatMsgJs :: UTCTime -> LogLevel -> [(String, Value)] -> Text
module LuminescentDreams.Logger.Standard
logMsgStd :: Logger -> LogLevel -> [(String, String)] -> String -> IO ()
formatMsgStd :: UTCTime -> LogMsg -> Text
instance Data.Text.Buildable.Buildable (GHC.Base.String, GHC.Base.String)
instance Data.Text.Buildable.Buildable [(GHC.Base.String, GHC.Base.String)]
-- | This is the main API module for the logger. You will generally want to
-- import this directly.
--
-- Usage suggestions:
module LuminescentDreams.Logger
-- | Ordinary configurations for a file-based logger.
data LogConfig
Stdout :: LogLevel -> LogConfig
Buffer :: (IORef Text) -> LogLevel -> LogConfig
FileLog :: FilePath -> LogLevel -> LogConfig
-- | An ordinary hierarchy of logging priorities.
data LogLevel
LogDebug :: LogLevel
LogInfo :: LogLevel
LogWarning :: LogLevel
LogError :: LogLevel
LogEmergency :: LogLevel
-- | The primary data structure to contain a logger of any kind.
data Logger
Logger :: (Text -> IO ()) -> LogLevel -> Logger
-- | Any IO action that accepts the log message
[logCmd_] :: Logger -> (Text -> IO ())
-- | The minimum level at which a log message should be accepted
[lvl_] :: Logger -> LogLevel
-- | Run an IO action with a log safely available. Logs will be properly
-- closed in the case of an exception. Logging is meant to happen to a
-- file, specified in LogConfig, so this may not be suitable if you want
-- to log to a different resource.
withLogger :: LogConfig -> (Logger -> IO a) -> IO a