@@ -16,12 +16,14 @@ module Control.Logger.Internal
1616
1717import Control.Has
1818import Control.Lens
19−import Control.Monad.IO.Class
2019import Control.DeepSeq
21−import Data.Aeson (ToJSON, FromJSON, Object, Value(..))
20+import Data.Aeson (ToJSON, FromJSON, Object)
2221import Data.Text (Text)
2322import Data.Monoid
2423import GHC.Stack
24+#if MIN_VERSION_mtl(2,3,0)
25+import Control.Monad.IO.Class
26+#endif
2527
2628
2729data LogSeverity
@@ -77,18 +79,4 @@ logMsgWith logger s t =
7779 liftIO $ runLogger logger callStack s t
7880
7981runLogger :: Logger -> CallStack -> LogSeverity -> Text -> IO ()
80−runLogger (Logger ctx theScrubber logger) cs ls txt
81− = logger (scrubContext theScrubber ctx) cs ls (appEndo theScrubber txt)
82−
83−
84−scrubContext :: Endo Text -> Object -> Object
85−scrubContext theScrubber = fmap doScrub
86− where
87− doScrub :: Value -> Value
88− doScrub = \case
89− Object object -> Object (fmap doScrub object)
90− Array array -> Array (fmap doScrub array)
91− String string -> String (appEndo theScrubber string)
92− n@Number{} -> n
93− b@Bool{} -> b
94− n@Null -> n
82+runLogger (Logger ctx theScrubber logger) cs ls txt = logger ctx cs ls (appEndo theScrubber txt)