@@ -8,7 +8,6 @@
88{-# LANGUAGE RankNTypes #-}
99{-# LANGUAGE RecordWildCards #-}
1010{-# LANGUAGE TemplateHaskell #-}
11−
1211module Katip.Core where
1312
1413-------------------------------------------------------------------------------
@@ -143,7 +142,7 @@ instance FromJSON Severity where
143142-------------------------------------------------------------------------------
144143-- | Log message with Builder unerneath; use '<>' to concat in O(1).
145144newtype LogStr = LogStr { unLogStr :: B.Builder }
146− deriving (Generic)
145+ deriving (Generic, Show)
147146
148147instance IsString LogStr where
149148 fromString = LogStr . B.fromString
@@ -203,6 +202,32 @@ data Item a = Item {
203202makeLenses ''Item
204203
205204
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) ++ "}"
217+
218+
219+newtype LocShow = LocShow Loc
220+
221+
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 ++ "}"
229+
230+
206231instance ToJSON a => ToJSON (Item a) where
207232 toJSON Item{..} = A.object
208233 [ "app" A..= _itemApp