@@ -8,7 +8,6 @@
8{-# LANGUAGE RankNTypes #-}
8{-# LANGUAGE RankNTypes #-}
9{-# LANGUAGE RecordWildCards #-}
9{-# LANGUAGE RecordWildCards #-}
10{-# LANGUAGE TemplateHaskell #-}
10{-# LANGUAGE TemplateHaskell #-}
12module Katip.Core where
11module Katip.Core where
14-------------------------------------------------------------------------------
13-------------------------------------------------------------------------------
@@ -143,7 +142,7 @@ instance FromJSON Severity where
143-------------------------------------------------------------------------------
142-------------------------------------------------------------------------------
144-- | Log message with Builder unerneath; use '<>' to concat in O(1).
143-- | Log message with Builder unerneath; use '<>' to concat in O(1).
145newtype LogStr = LogStr { unLogStr :: B.Builder }
144newtype LogStr = LogStr { unLogStr :: B.Builder }
146− deriving (Generic)
145+ deriving (Generic, Show)
148instance IsString LogStr where
147instance IsString LogStr where
149 fromString = LogStr . B.fromString
148 fromString = LogStr . B.fromString
@@ -203,6 +202,32 @@ data Item a = Item {
203makeLenses ''Item
202makeLenses ''Item
205+instance Show a => Show (Item a) where
206+ show Item{..} = "Item {_itemApp = " ++ show _itemApp ++ ", " ++
207+ "_itemEnv = " ++ show _itemEnv ++ ", " ++
208+ "_itemSeverity = " ++ show _itemSeverity ++ ", " ++
209+ "_itemThread = " ++ show _itemThread ++ ", " ++
210+ "_itemHost = " ++ show _itemHost ++ ", " ++
211+ "_itemProcess = " ++ show _itemProcess ++ ", " ++
212+ "_itemPayload = " ++ show _itemPayload ++ ", " ++
213+ "_itemMessage = " ++ show _itemMessage ++ ", " ++
214+ "_itemTime = " ++ show _itemTime ++ ", " ++
215+ "_itemNamespace = " ++ show _itemNamespace ++ ", " ++
216+ "_itemLoc = " ++ show (LocShow <$> _itemLoc) ++ "}"
219+newtype LocShow = LocShow Loc
222+instance Show LocShow where
223+ show (LocShow Loc{..}) =
224+ "Loc {loc_filename = " ++ show loc_filename ++ ", " ++
225+ "loc_package = " ++ show loc_package ++ ", " ++
226+ "loc_module = " ++ show loc_module ++ ", " ++
227+ "loc_start = " ++ show loc_start ++ ", " ++
228+ "loc_end = " ++ show loc_end ++ "}"
206instance ToJSON a => ToJSON (Item a) where
231instance ToJSON a => ToJSON (Item a) where
207 toJSON Item{..} = A.object
232 toJSON Item{..} = A.object
208 [ "app" A..= _itemApp
233 [ "app" A..= _itemApp