{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Soup.Objects.Logger
    (

-- * Exported types
    Logger(..)                              ,
    IsLogger                                ,
    toLogger                                ,
    noLogger                                ,


 -- * Methods
-- ** attach #method:attach#

#if ENABLE_OVERLOADING
    LoggerAttachMethodInfo                  ,
#endif
    loggerAttach                            ,


-- ** detach #method:detach#

#if ENABLE_OVERLOADING
    LoggerDetachMethodInfo                  ,
#endif
    loggerDetach                            ,


-- ** new #method:new#

    loggerNew                               ,


-- ** setPrinter #method:setPrinter#

#if ENABLE_OVERLOADING
    LoggerSetPrinterMethodInfo              ,
#endif
    loggerSetPrinter                        ,


-- ** setRequestFilter #method:setRequestFilter#

#if ENABLE_OVERLOADING
    LoggerSetRequestFilterMethodInfo        ,
#endif
    loggerSetRequestFilter                  ,


-- ** setResponseFilter #method:setResponseFilter#

#if ENABLE_OVERLOADING
    LoggerSetResponseFilterMethodInfo       ,
#endif
    loggerSetResponseFilter                 ,




 -- * Properties
-- ** level #attr:level#
{- | The level of logging output

/Since: 2.56/
-}
#if ENABLE_OVERLOADING
    LoggerLevelPropertyInfo                 ,
#endif
    constructLoggerLevel                    ,
    getLoggerLevel                          ,
#if ENABLE_OVERLOADING
    loggerLevel                             ,
#endif
    setLoggerLevel                          ,


-- ** maxBodySize #attr:maxBodySize#
{- | If 'GI.Soup.Objects.Logger.Logger':@/level/@ is 'GI.Soup.Enums.LoggerLogLevelBody', this gives
the maximum number of bytes of the body that will be logged.
(-1 means \"no limit\".)

/Since: 2.56/
-}
#if ENABLE_OVERLOADING
    LoggerMaxBodySizePropertyInfo           ,
#endif
    constructLoggerMaxBodySize              ,
    getLoggerMaxBodySize                    ,
#if ENABLE_OVERLOADING
    loggerMaxBodySize                       ,
#endif
    setLoggerMaxBodySize                    ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
import {-# SOURCE #-} qualified GI.Soup.Interfaces.SessionFeature as Soup.SessionFeature
import {-# SOURCE #-} qualified GI.Soup.Objects.Session as Soup.Session

-- | Memory-managed wrapper type.
newtype Logger = Logger (ManagedPtr Logger)
foreign import ccall "soup_logger_get_type"
    c_soup_logger_get_type :: IO GType

instance GObject Logger where
    gobjectType = c_soup_logger_get_type


-- | Type class for types which can be safely cast to `Logger`, for instance with `toLogger`.
class (GObject o, O.IsDescendantOf Logger o) => IsLogger o
instance (GObject o, O.IsDescendantOf Logger o) => IsLogger o

instance O.HasParentTypes Logger
type instance O.ParentTypes Logger = '[GObject.Object.Object, Soup.SessionFeature.SessionFeature]

-- | Cast to `Logger`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toLogger :: (MonadIO m, IsLogger o) => o -> m Logger
toLogger = liftIO . unsafeCastTo Logger

-- | A convenience alias for `Nothing` :: `Maybe` `Logger`.
noLogger :: Maybe Logger
noLogger = Nothing

#if ENABLE_OVERLOADING
type family ResolveLoggerMethod (t :: Symbol) (o :: *) :: * where
    ResolveLoggerMethod "addFeature" o = Soup.SessionFeature.SessionFeatureAddFeatureMethodInfo
    ResolveLoggerMethod "attach" o = LoggerAttachMethodInfo
    ResolveLoggerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveLoggerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveLoggerMethod "detach" o = LoggerDetachMethodInfo
    ResolveLoggerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveLoggerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveLoggerMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveLoggerMethod "hasFeature" o = Soup.SessionFeature.SessionFeatureHasFeatureMethodInfo
    ResolveLoggerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveLoggerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveLoggerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveLoggerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveLoggerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveLoggerMethod "removeFeature" o = Soup.SessionFeature.SessionFeatureRemoveFeatureMethodInfo
    ResolveLoggerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveLoggerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveLoggerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveLoggerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveLoggerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveLoggerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveLoggerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveLoggerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveLoggerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveLoggerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveLoggerMethod "setPrinter" o = LoggerSetPrinterMethodInfo
    ResolveLoggerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveLoggerMethod "setRequestFilter" o = LoggerSetRequestFilterMethodInfo
    ResolveLoggerMethod "setResponseFilter" o = LoggerSetResponseFilterMethodInfo
    ResolveLoggerMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveLoggerMethod t Logger, O.MethodInfo info Logger p) => OL.IsLabel t (Logger -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- VVV Prop "level"
   -- Type: TInterface (Name {namespace = "Soup", name = "LoggerLogLevel"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@level@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' logger #level
@
-}
getLoggerLevel :: (MonadIO m, IsLogger o) => o -> m Soup.Enums.LoggerLogLevel
getLoggerLevel obj = liftIO $ B.Properties.getObjectPropertyEnum obj "level"

{- |
Set the value of the “@level@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' logger [ #level 'Data.GI.Base.Attributes.:=' value ]
@
-}
setLoggerLevel :: (MonadIO m, IsLogger o) => o -> Soup.Enums.LoggerLogLevel -> m ()
setLoggerLevel obj val = liftIO $ B.Properties.setObjectPropertyEnum obj "level" val

{- |
Construct a `GValueConstruct` with valid value for the “@level@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructLoggerLevel :: (IsLogger o) => Soup.Enums.LoggerLogLevel -> IO (GValueConstruct o)
constructLoggerLevel val = B.Properties.constructObjectPropertyEnum "level" val

#if ENABLE_OVERLOADING
data LoggerLevelPropertyInfo
instance AttrInfo LoggerLevelPropertyInfo where
    type AttrAllowedOps LoggerLevelPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint LoggerLevelPropertyInfo = (~) Soup.Enums.LoggerLogLevel
    type AttrBaseTypeConstraint LoggerLevelPropertyInfo = IsLogger
    type AttrGetType LoggerLevelPropertyInfo = Soup.Enums.LoggerLogLevel
    type AttrLabel LoggerLevelPropertyInfo = "level"
    type AttrOrigin LoggerLevelPropertyInfo = Logger
    attrGet _ = getLoggerLevel
    attrSet _ = setLoggerLevel
    attrConstruct _ = constructLoggerLevel
    attrClear _ = undefined
#endif

-- VVV Prop "max-body-size"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@max-body-size@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' logger #maxBodySize
@
-}
getLoggerMaxBodySize :: (MonadIO m, IsLogger o) => o -> m Int32
getLoggerMaxBodySize obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "max-body-size"

{- |
Set the value of the “@max-body-size@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' logger [ #maxBodySize 'Data.GI.Base.Attributes.:=' value ]
@
-}
setLoggerMaxBodySize :: (MonadIO m, IsLogger o) => o -> Int32 -> m ()
setLoggerMaxBodySize obj val = liftIO $ B.Properties.setObjectPropertyInt32 obj "max-body-size" val

{- |
Construct a `GValueConstruct` with valid value for the “@max-body-size@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructLoggerMaxBodySize :: (IsLogger o) => Int32 -> IO (GValueConstruct o)
constructLoggerMaxBodySize val = B.Properties.constructObjectPropertyInt32 "max-body-size" val

#if ENABLE_OVERLOADING
data LoggerMaxBodySizePropertyInfo
instance AttrInfo LoggerMaxBodySizePropertyInfo where
    type AttrAllowedOps LoggerMaxBodySizePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint LoggerMaxBodySizePropertyInfo = (~) Int32
    type AttrBaseTypeConstraint LoggerMaxBodySizePropertyInfo = IsLogger
    type AttrGetType LoggerMaxBodySizePropertyInfo = Int32
    type AttrLabel LoggerMaxBodySizePropertyInfo = "max-body-size"
    type AttrOrigin LoggerMaxBodySizePropertyInfo = Logger
    attrGet _ = getLoggerMaxBodySize
    attrSet _ = setLoggerMaxBodySize
    attrConstruct _ = constructLoggerMaxBodySize
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList Logger
type instance O.AttributeList Logger = LoggerAttributeList
type LoggerAttributeList = ('[ '("level", LoggerLevelPropertyInfo), '("maxBodySize", LoggerMaxBodySizePropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
loggerLevel :: AttrLabelProxy "level"
loggerLevel = AttrLabelProxy

loggerMaxBodySize :: AttrLabelProxy "maxBodySize"
loggerMaxBodySize = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList Logger = LoggerSignalList
type LoggerSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Logger::new
-- method type : Constructor
-- Args : [Arg {argCName = "level", argType = TInterface (Name {namespace = "Soup", name = "LoggerLogLevel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the debug level", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_body_size", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum body size to output, or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "Logger"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_logger_new" soup_logger_new ::
    CUInt ->                                -- level : TInterface (Name {namespace = "Soup", name = "LoggerLogLevel"})
    Int32 ->                                -- max_body_size : TBasicType TInt
    IO (Ptr Logger)

{- |
Creates a new 'GI.Soup.Objects.Logger.Logger' with the given debug level. If /@level@/ is
'GI.Soup.Enums.LoggerLogLevelBody', /@maxBodySize@/ gives the maximum number of
bytes of the body that will be logged. (-1 means \"no limit\".)

If you need finer control over what message parts are and aren\'t
logged, use 'GI.Soup.Objects.Logger.loggerSetRequestFilter' and
'GI.Soup.Objects.Logger.loggerSetResponseFilter'.
-}
loggerNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Soup.Enums.LoggerLogLevel
    {- ^ /@level@/: the debug level -}
    -> Int32
    {- ^ /@maxBodySize@/: the maximum body size to output, or -1 -}
    -> m Logger
    {- ^ __Returns:__ a new 'GI.Soup.Objects.Logger.Logger' -}
loggerNew level maxBodySize = liftIO $ do
    let level' = (fromIntegral . fromEnum) level
    result <- soup_logger_new level' maxBodySize
    checkUnexpectedReturnNULL "loggerNew" result
    result' <- (wrapObject Logger) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Logger::attach
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "logger", argType = TInterface (Name {namespace = "Soup", name = "Logger"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupLogger", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_logger_attach" soup_logger_attach ::
    Ptr Logger ->                           -- logger : TInterface (Name {namespace = "Soup", name = "Logger"})
    Ptr Soup.Session.Session ->             -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    IO ()

{-# DEPRECATED loggerAttach ["Use 'GI.Soup.Objects.Session.sessionAddFeature' instead."] #-}
{- |
Sets /@logger@/ to watch /@session@/ and print debug information for
its messages.

(The session will take a reference on /@logger@/, which will be
removed when you call 'GI.Soup.Objects.Logger.loggerDetach', or when the session is
destroyed.)
-}
loggerAttach ::
    (B.CallStack.HasCallStack, MonadIO m, IsLogger a, Soup.Session.IsSession b) =>
    a
    {- ^ /@logger@/: a 'GI.Soup.Objects.Logger.Logger' -}
    -> b
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> m ()
loggerAttach logger session = liftIO $ do
    logger' <- unsafeManagedPtrCastPtr logger
    session' <- unsafeManagedPtrCastPtr session
    soup_logger_attach logger' session'
    touchManagedPtr logger
    touchManagedPtr session
    return ()

#if ENABLE_OVERLOADING
data LoggerAttachMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsLogger a, Soup.Session.IsSession b) => O.MethodInfo LoggerAttachMethodInfo a signature where
    overloadedMethod _ = loggerAttach

#endif

-- method Logger::detach
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "logger", argType = TInterface (Name {namespace = "Soup", name = "Logger"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupLogger", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "session", argType = TInterface (Name {namespace = "Soup", name = "Session"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupSession", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_logger_detach" soup_logger_detach ::
    Ptr Logger ->                           -- logger : TInterface (Name {namespace = "Soup", name = "Logger"})
    Ptr Soup.Session.Session ->             -- session : TInterface (Name {namespace = "Soup", name = "Session"})
    IO ()

{-# DEPRECATED loggerDetach ["Use 'GI.Soup.Objects.Session.sessionRemoveFeature' instead."] #-}
{- |
Stops /@logger@/ from watching /@session@/.
-}
loggerDetach ::
    (B.CallStack.HasCallStack, MonadIO m, IsLogger a, Soup.Session.IsSession b) =>
    a
    {- ^ /@logger@/: a 'GI.Soup.Objects.Logger.Logger' -}
    -> b
    {- ^ /@session@/: a 'GI.Soup.Objects.Session.Session' -}
    -> m ()
loggerDetach logger session = liftIO $ do
    logger' <- unsafeManagedPtrCastPtr logger
    session' <- unsafeManagedPtrCastPtr session
    soup_logger_detach logger' session'
    touchManagedPtr logger
    touchManagedPtr session
    return ()

#if ENABLE_OVERLOADING
data LoggerDetachMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsLogger a, Soup.Session.IsSession b) => O.MethodInfo LoggerDetachMethodInfo a signature where
    overloadedMethod _ = loggerDetach

#endif

-- method Logger::set_printer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "logger", argType = TInterface (Name {namespace = "Soup", name = "Logger"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupLogger", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "printer", argType = TInterface (Name {namespace = "Soup", name = "LoggerPrinter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the callback for printing logging output", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "printer_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDestroyNotify to free @printer_data", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_logger_set_printer" soup_logger_set_printer ::
    Ptr Logger ->                           -- logger : TInterface (Name {namespace = "Soup", name = "Logger"})
    FunPtr Soup.Callbacks.C_LoggerPrinter -> -- printer : TInterface (Name {namespace = "Soup", name = "LoggerPrinter"})
    Ptr () ->                               -- printer_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets up an alternate log printing routine, if you don\'t want
the log to go to \<literal>stdout\<\/literal>.
-}
loggerSetPrinter ::
    (B.CallStack.HasCallStack, MonadIO m, IsLogger a) =>
    a
    {- ^ /@logger@/: a 'GI.Soup.Objects.Logger.Logger' -}
    -> Soup.Callbacks.LoggerPrinter
    {- ^ /@printer@/: the callback for printing logging output -}
    -> m ()
loggerSetPrinter logger printer = liftIO $ do
    logger' <- unsafeManagedPtrCastPtr logger
    printer' <- Soup.Callbacks.mk_LoggerPrinter (Soup.Callbacks.wrap_LoggerPrinter Nothing (Soup.Callbacks.drop_closures_LoggerPrinter printer))
    let printerData = castFunPtrToPtr printer'
    let destroy = safeFreeFunPtrPtr
    soup_logger_set_printer logger' printer' printerData destroy
    touchManagedPtr logger
    return ()

#if ENABLE_OVERLOADING
data LoggerSetPrinterMethodInfo
instance (signature ~ (Soup.Callbacks.LoggerPrinter -> m ()), MonadIO m, IsLogger a) => O.MethodInfo LoggerSetPrinterMethodInfo a signature where
    overloadedMethod _ = loggerSetPrinter

#endif

-- method Logger::set_request_filter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "logger", argType = TInterface (Name {namespace = "Soup", name = "Logger"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupLogger", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "request_filter", argType = TInterface (Name {namespace = "Soup", name = "LoggerFilter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the callback for request debugging", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDestroyNotify to free @filter_data", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_logger_set_request_filter" soup_logger_set_request_filter ::
    Ptr Logger ->                           -- logger : TInterface (Name {namespace = "Soup", name = "Logger"})
    FunPtr Soup.Callbacks.C_LoggerFilter -> -- request_filter : TInterface (Name {namespace = "Soup", name = "LoggerFilter"})
    Ptr () ->                               -- filter_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets up a filter to determine the log level for a given request.
For each HTTP request /@logger@/ will invoke /@requestFilter@/ to
determine how much (if any) of that request to log. (If you do not
set a request filter, /@logger@/ will just always log requests at the
level passed to 'GI.Soup.Objects.Logger.loggerNew'.)
-}
loggerSetRequestFilter ::
    (B.CallStack.HasCallStack, MonadIO m, IsLogger a) =>
    a
    {- ^ /@logger@/: a 'GI.Soup.Objects.Logger.Logger' -}
    -> Soup.Callbacks.LoggerFilter
    {- ^ /@requestFilter@/: the callback for request debugging -}
    -> m ()
loggerSetRequestFilter logger requestFilter = liftIO $ do
    logger' <- unsafeManagedPtrCastPtr logger
    requestFilter' <- Soup.Callbacks.mk_LoggerFilter (Soup.Callbacks.wrap_LoggerFilter Nothing (Soup.Callbacks.drop_closures_LoggerFilter requestFilter))
    let filterData = castFunPtrToPtr requestFilter'
    let destroy = safeFreeFunPtrPtr
    soup_logger_set_request_filter logger' requestFilter' filterData destroy
    touchManagedPtr logger
    return ()

#if ENABLE_OVERLOADING
data LoggerSetRequestFilterMethodInfo
instance (signature ~ (Soup.Callbacks.LoggerFilter -> m ()), MonadIO m, IsLogger a) => O.MethodInfo LoggerSetRequestFilterMethodInfo a signature where
    overloadedMethod _ = loggerSetRequestFilter

#endif

-- method Logger::set_response_filter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "logger", argType = TInterface (Name {namespace = "Soup", name = "Logger"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupLogger", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "response_filter", argType = TInterface (Name {namespace = "Soup", name = "LoggerFilter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the callback for response debugging", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDestroyNotify to free @filter_data", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_logger_set_response_filter" soup_logger_set_response_filter ::
    Ptr Logger ->                           -- logger : TInterface (Name {namespace = "Soup", name = "Logger"})
    FunPtr Soup.Callbacks.C_LoggerFilter -> -- response_filter : TInterface (Name {namespace = "Soup", name = "LoggerFilter"})
    Ptr () ->                               -- filter_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets up a filter to determine the log level for a given response.
For each HTTP response /@logger@/ will invoke /@responseFilter@/ to
determine how much (if any) of that response to log. (If you do not
set a response filter, /@logger@/ will just always log responses at
the level passed to 'GI.Soup.Objects.Logger.loggerNew'.)
-}
loggerSetResponseFilter ::
    (B.CallStack.HasCallStack, MonadIO m, IsLogger a) =>
    a
    {- ^ /@logger@/: a 'GI.Soup.Objects.Logger.Logger' -}
    -> Soup.Callbacks.LoggerFilter
    {- ^ /@responseFilter@/: the callback for response debugging -}
    -> m ()
loggerSetResponseFilter logger responseFilter = liftIO $ do
    logger' <- unsafeManagedPtrCastPtr logger
    responseFilter' <- Soup.Callbacks.mk_LoggerFilter (Soup.Callbacks.wrap_LoggerFilter Nothing (Soup.Callbacks.drop_closures_LoggerFilter responseFilter))
    let filterData = castFunPtrToPtr responseFilter'
    let destroy = safeFreeFunPtrPtr
    soup_logger_set_response_filter logger' responseFilter' filterData destroy
    touchManagedPtr logger
    return ()

#if ENABLE_OVERLOADING
data LoggerSetResponseFilterMethodInfo
instance (signature ~ (Soup.Callbacks.LoggerFilter -> m ()), MonadIO m, IsLogger a) => O.MethodInfo LoggerSetResponseFilterMethodInfo a signature where
    overloadedMethod _ = loggerSetResponseFilter

#endif