-- | Log functions using CallStack support in place of Template Haskell
--
-- @since 0.3.19
module Control.Monad.Logger.CallStack (
    module Log
  , logDebug
  , logInfo
  , logWarn
  , logError
  , logOther
  , logDebugSH
  , logInfoSH
  , logWarnSH
  , logErrorSH
  , logOtherSH
  ) where

import           Control.Monad.Logger as Log hiding (logDebug, logDebugSH,
                                              logError, logErrorSH, logInfo,
                                              logInfoSH, logOther, logOtherSH,
                                              logWarn, logWarnSH)
import           Data.Text            (Text)
import qualified Data.Text            as Text
import           GHC.Stack

-- | Logs a message with the location provided by
-- an implicit 'CallStack'.
--
-- @since 0.3.19
logDebug :: (HasCallStack, Log.MonadLogger m) => Text -> m ()
logDebug :: Text -> m ()
logDebug = CallStack -> Text -> m ()
forall (m :: * -> *). MonadLogger m => CallStack -> Text -> m ()
Log.logDebugCS CallStack
HasCallStack => CallStack
callStack

-- | See 'logDebug'
--
-- @since 0.3.19
logInfo :: (HasCallStack, Log.MonadLogger m) => Text -> m ()
logInfo :: Text -> m ()
logInfo = CallStack -> Text -> m ()
forall (m :: * -> *). MonadLogger m => CallStack -> Text -> m ()
Log.logInfoCS CallStack
HasCallStack => CallStack
callStack

-- | See 'logDebug'
--
-- @since 0.3.19
logWarn :: (HasCallStack, Log.MonadLogger m) => Text -> m ()
logWarn :: Text -> m ()
logWarn = CallStack -> Text -> m ()
forall (m :: * -> *). MonadLogger m => CallStack -> Text -> m ()
Log.logWarnCS CallStack
HasCallStack => CallStack
callStack

-- | See 'logDebug'
--
-- @since 0.3.19
logError :: (HasCallStack, Log.MonadLogger m) => Text -> m ()
logError :: Text -> m ()
logError = CallStack -> Text -> m ()
forall (m :: * -> *). MonadLogger m => CallStack -> Text -> m ()
Log.logErrorCS CallStack
HasCallStack => CallStack
callStack

-- | See 'logDebug'
--
-- @since 0.3.25
logOther :: (HasCallStack, Log.MonadLogger m) => Log.LogLevel -> Text -> m ()
logOther :: LogLevel -> Text -> m ()
logOther = CallStack -> LogLevel -> Text -> m ()
forall (m :: * -> *).
MonadLogger m =>
CallStack -> LogLevel -> Text -> m ()
Log.logOtherCS CallStack
HasCallStack => CallStack
callStack

-- | Logs a showable value with the location provided by
-- an implicit 'CallStack'.
--
-- @since 0.3.25
logDebugSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m ()
logDebugSH :: a -> m ()
logDebugSH = CallStack -> Text -> m ()
forall (m :: * -> *). MonadLogger m => CallStack -> Text -> m ()
Log.logDebugCS CallStack
HasCallStack => CallStack
callStack (Text -> m ()) -> (a -> Text) -> a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
Text.pack (String -> Text) -> (a -> String) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> String
forall a. Show a => a -> String
show

-- | See 'logDebugSH'
--
-- @since 0.3.25
logInfoSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m ()
logInfoSH :: a -> m ()
logInfoSH = CallStack -> Text -> m ()
forall (m :: * -> *). MonadLogger m => CallStack -> Text -> m ()
Log.logInfoCS CallStack
HasCallStack => CallStack
callStack (Text -> m ()) -> (a -> Text) -> a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
Text.pack (String -> Text) -> (a -> String) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> String
forall a. Show a => a -> String
show

-- | See 'logDebugSH'
--
-- @since 0.3.25
logWarnSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m ()
logWarnSH :: a -> m ()
logWarnSH = CallStack -> Text -> m ()
forall (m :: * -> *). MonadLogger m => CallStack -> Text -> m ()
Log.logWarnCS CallStack
HasCallStack => CallStack
callStack (Text -> m ()) -> (a -> Text) -> a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
Text.pack (String -> Text) -> (a -> String) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> String
forall a. Show a => a -> String
show

-- | See 'logDebugSH'
--
-- @since 0.3.25
logErrorSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m ()
logErrorSH :: a -> m ()
logErrorSH = CallStack -> Text -> m ()
forall (m :: * -> *). MonadLogger m => CallStack -> Text -> m ()
Log.logErrorCS CallStack
HasCallStack => CallStack
callStack (Text -> m ()) -> (a -> Text) -> a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
Text.pack (String -> Text) -> (a -> String) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> String
forall a. Show a => a -> String
show

-- | See 'logDebugSH'
--
-- @since 0.3.25
logOtherSH :: (HasCallStack, Log.MonadLogger m, Show a) => Log.LogLevel -> a -> m ()
logOtherSH :: LogLevel -> a -> m ()
logOtherSH LogLevel
lvl = CallStack -> LogLevel -> Text -> m ()
forall (m :: * -> *).
MonadLogger m =>
CallStack -> LogLevel -> Text -> m ()
Log.logOtherCS CallStack
HasCallStack => CallStack
callStack LogLevel
lvl (Text -> m ()) -> (a -> Text) -> a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
Text.pack (String -> Text) -> (a -> String) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> String
forall a. Show a => a -> String
show