File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import Control.Monad.Cont (
33
33
ContT (.. ),
34
34
runContT ,
35
35
)
36
+ import Data.Aeson qualified as JSON
36
37
import Data.Functor.Contravariant (
37
38
contramap ,
38
39
)
@@ -282,6 +283,8 @@ makeKoreLogger exeName startTime timestampSwitch koreLogFormat logActionText =
282
283
prettyActualEntry timestamp entry@ (SomeEntry entryContext actualEntry)
283
284
| OneLine <- koreLogFormat =
284
285
Pretty. hsep [header, oneLineDoc actualEntry]
286
+ | Json <- koreLogFormat =
287
+ Pretty. hsep [header, Pretty. viaShow . JSON. encode $ oneLineJson actualEntry]
285
288
| otherwise =
286
289
(Pretty. vsep . concat )
287
290
[ [header]
Original file line number Diff line number Diff line change @@ -181,6 +181,7 @@ instance Show KoreLogType where
181
181
data KoreLogFormat
182
182
= Standard
183
183
| OneLine
184
+ | Json
184
185
deriving stock (Eq , Show )
185
186
186
187
instance Default KoreLogType where
@@ -204,11 +205,12 @@ parseKoreLogFormat = option formatReader info
204
205
formatReader = Options. maybeReader $ \ case
205
206
" standard" -> Just Standard
206
207
" oneline" -> Just OneLine
208
+ " json" -> Just Json
207
209
_ -> Nothing
208
210
info =
209
211
mempty
210
212
<> Options. long " log-format"
211
- <> Options. help " Log format: standard, oneline"
213
+ <> Options. help " Log format: standard, oneline, json "
212
214
<> Options. value def
213
215
214
216
type EntryTypes = Set SomeTypeRep
@@ -672,6 +674,7 @@ unparseKoreLogOptions
672
674
673
675
koreLogFormatFlag Standard = []
674
676
koreLogFormatFlag OneLine = [" --log-format=oneline" ]
677
+ koreLogFormatFlag Json = [" --log-format=json" ]
675
678
676
679
timestampsSwitchFlag TimestampsEnable = [" --enable-log-timestamps" ]
677
680
timestampsSwitchFlag TimestampsDisable = [" --disable-log-timestamps" ]
You can’t perform that action at this time.
0 commit comments