-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A super simple logging module. -- -- A super simple logging module that primarily outputs json-formatted -- messages. @package micrologger @version 0.5.0.0 -- | Logger type definitions module LuminescentDreams.Logger.Types -- | An ordinary hierarchy of logging priorities. data LogLevel LogDebug :: LogLevel LogInfo :: LogLevel LogWarning :: LogLevel LogError :: LogLevel LogEmergency :: LogLevel tzFormat :: String -- | The primary data structure to contain a logger of any kind. data Logger Logger :: (Text -> IO ()) -> LogLevel -> Text -> [Text] -> Logger -- | Any IO action that accepts the log message [_logCmd] :: Logger -> (Text -> IO ()) [_logLvl] :: Logger -> LogLevel [_logApp] :: Logger -> Text -- | The minimum level at which a log message should be accepted [_logTags] :: Logger -> [Text] -- | Generate standard text representations of a log level. This is useful -- to the Standard logger but may not be interesting to any others. logTags :: Lens' Logger [Text] logLvl :: Lens' Logger LogLevel logCmd :: Lens' Logger (Text -> IO ()) logApp :: Lens' Logger Text instance GHC.Show.Show LuminescentDreams.Logger.Types.LogLevel instance GHC.Classes.Ord LuminescentDreams.Logger.Types.LogLevel instance GHC.Classes.Eq LuminescentDreams.Logger.Types.LogLevel instance Data.Text.Buildable.Buildable LuminescentDreams.Logger.Types.LogLevel module LuminescentDreams.Logger.Standard data LogMsg LogMsg :: LogLevel -> [(String, String)] -> String -> LogMsg logMsgStd :: Logger -> LogLevel -> [(String, String)] -> String -> IO () logMsg_ :: Logger -> LogMsg -> IO () formatMsgStd :: Text -> [Text] -> 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)] -- | 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 logMsgJs :: Logger -> LogLevel -> [(String, Value)] -> IO () -- | Format a message for LogZ JSON format. formatMsgJs :: Text -> [Text] -> UTCTime -> LogLevel -> [(String, Value)] -> Text -- | 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 -> Text -> [Text] -> LogConfig Buffer :: (IORef Text) -> LogLevel -> Text -> [Text] -> LogConfig FileLog :: FilePath -> LogLevel -> Text -> [Text] -> 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 -> Text -> [Text] -> Logger -- | Any IO action that accepts the log message [_logCmd] :: Logger -> (Text -> IO ()) [_logLvl] :: Logger -> LogLevel [_logApp] :: Logger -> Text -- | The minimum level at which a log message should be accepted [_logTags] :: Logger -> [Text] -- | 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