<p>I figured it out...
You can configure it with the 2nd parameter, TraceConfig, on the call runEmulatorTraceIO'.</p>
<p><a href="https://play.marlowe-finance.io/doc/haddock/plutus-contract/html/Plutus-Trace-Emulator.html#t:TraceConfig" rel="nofollow noreferrer">https://play.marlowe-finance.io/doc/haddock/plutus-contract/html/Plutus-Trace-Emulator.html#t:TraceConfig</a></p>
<p>There you can put on the traceConfigMinLogLevel field <code>MonadExtras.Info</code> to Log only debug level info.</p>
<pre><code>traceConfig = TraceEmulator.TraceConfig
  { 
    traceConfigShowEvent = traceConfigShowEventExample,
    -- ^ Function to decide how to print the particular events.
    traceConfigOutputHandle = SystemIO.stdout, -- withFile &quot;/tmp/trace-log.txt&quot; WriteMode $ \h -&gt; h
    -- ^ Where to print the outputs to. Default: 'System.IO.stdout'
    traceConfigMinLogLevel = MonadExtras.Info
    -- Debug     
    -- Info  
    -- Notice    
    -- Warning   
    -- Error     
    -- Critical  
    -- Alert     
    -- Emergency
  }

traceConfigShowEventExample :: MonadExtras.LogMessage WalletEmulatorTypes.EmulatorEvent -&gt; Maybe P.String
traceConfigShowEventExample (MonadExtras.LogMessage _minLogLevel (WalletEmulatorTypes.EmulatorTimeEvent slot e)) =
    let logMsgMaybe = case e of
          WalletEmulatorMultiAgent.UserThreadEvent (TraceEmulatorTypes.UserLog msg) -&gt;
              Just $ &quot;*** USER LOG: &quot; &lt;&gt; msg
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog (TraceEmulatorTypes.ContractLog (DataAeson.String msg)) _ _) -&gt;
              Just $ &quot;*** CONTRACT LOG: &quot; &lt;&gt; P.show msg
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog (TraceEmulatorTypes.StoppedWithError err)       _ _) -&gt;
              Just $ &quot;*** CONTRACT STOPPED WITH ERROR: &quot; &lt;&gt; P.show err
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog TraceEmulatorTypes.NoRequestsHandled            _ _) -&gt;
              Nothing
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog (TraceEmulatorTypes.HandledRequest _)           _ _) -&gt;
              Nothing
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog (TraceEmulatorTypes.CurrentRequests _)          _ _) -&gt;
              Nothing
          WalletEmulatorMultiAgent.SchedulerEvent _ -&gt;
              Nothing
          WalletEmulatorMultiAgent.WalletEvent _ _ -&gt;
              Nothing
          ev -&gt;
              Just . Prettyprinter.renderString . Prettyprinter.layoutPretty Prettyprinter.defaultLayoutOptions . Prettyprinter.pretty $ ev
        paddedSlotNo = pad 5 (Ledger.getSlot slot)
     in fmap (\m -&gt; &quot;Slot &quot; &lt;&gt; paddedSlotNo &lt;&gt; &quot;: &quot; &lt;&gt; m) logMsgMaybe
 where
    pad :: P.Int -&gt; Integer -&gt; P.String
    pad n = (\x -&gt; P.replicate (n P.- P.length x) '0' ++ x) . P.show
</code></pre>

CC BY-SA 4.0
2023-03-18T10:19:20.527Z
2023-03-18T10:19:20.527Z
Manu Padilla
<p>I also find the emulator trace way to verbose, so I prefer to use the pab simluator that has much better and concise debugging info.  For info to run the simulator with working code you can check out my repository here:</p>
<p><a href="https://github.com/lley154/cardano-lottery#developer-testing" rel="nofollow noreferrer">https://github.com/lley154/cardano-lottery#developer-testing</a></p>

CC BY-SA 4.0
2022-07-18T18:33:38.980Z
Thanks! Ill take a look! Sounds promising. I''ll mark this as an answer if it works as you said! I'm taking a look at your code.
Manu Padilla
CC BY-SA 4.0
2022-07-26T17:22:22.450Z
it opens me a world using the pab simulator inspired in your code! thank you :)
Manu Padilla
CC BY-SA 4.0
2022-07-28T17:41:11.263Z
great to hear it was helpful!
lley154
CC BY-SA 4.0
2022-07-18T11:49:42.587Z
2022-07-18T11:49:42.587Z
lley154
<p>Im using the trace emulator, but the debug info that I print in the terminal using logInfo is completly lost in middle of hundreds of lines of contract logs made automaticaly by the emulator.</p>
<p>There is a way to set the level of verbose?</p>
<p>Here is an example how it looks:</p>
<p>Slot 00104: *** CONTRACT LOG: &quot;CALCULATED Rewards: 3000000&quot;<br />
Slot 00104: 00000000-0000-4000-8000-000000000002 {Wallet Wc30e}:
Contract log: Object (fromList [(&quot;mkTxLogLookups&quot;,Object (fromList [(&quot;slMPS&quot;,Array [Array [String &quot;5abd1e1ba79c8ea981f2949126e186c1709b1c0a118be2a11648a3a8&quot;,Object (fromList [(&quot;getMintingPolicy&quot;,String &quot;5908c0010000332332233322232323322332232323332223233322232333333332222222232333222323333222232323322323332223232323322332232323333322222332233223322332233223322332222232325335302f332235300a0012235300e002222222222233335302200b203f2333553059120013233505f223335350180032200200200135350160012200133501622533530400021042100103f235302b35301c0012200122235303000322335305500220462333573466e3c00406c11c11802c80fc80fccccd5cd19b8735573a6ea801120002047232635304633573809408e08a0886666ae68cdc39aab9d5002480008cc028c8c8c8c8c8c8c8c8c8c8c8cccd5cd19b8735573aa01490001199999999980c19a813119191999ab9a3370e6aae754009200023301e303635742a00460566ae84d5d1280111931a982b19ab9c05a057055054135573ca00226ea8004d5d0a80519a8130139aba150093335502d75ca0586ae854020ccd540b5d728161aba1500733502603f35742a00c66a04c66aa0a0090eb4d5d0a8029919191999ab9a3370e6aae754009200023350203232323333573466e1cd55cea80124000466a05066a07ceb4d5d0a80118219aba135744a004464c6a60b466ae7017816c1641604d55cf280089baa00135742a0046464646666ae68cdc39aab9d5002480008cd4098cd40f9d69aba150023043357426ae8940088c98d4c168cd5ce02f02d82c82c09aab9e5001137540026ae84d5d1280111931a982b19ab9c05a057055054135573ca00226ea8004d5d0a80219a8133ae35742a00666a04c66aa0a0eb88004d5d0a801181a9aba135744a004464c6a60a466ae7015814c1441404d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d55cf280089baa00135742a0046464646666ae68cdc3a800a400c4603a606e6ae84d55cf280191999ab9a3370ea00490021180e18209aba135573ca00846666ae68cdc3a801a40044603860586ae84d55cf280291999ab9a3370ea00890001180f9bae357426aae7940188c98d4c134cd5ce02882702602582502482409aab9d5001137540026ae84d5d1280111931a982319ab9c04a0470450441046132635304533573892010350543500046044135573ca00226ea800448848cc00400c008480048848cc00400c0088004888888888848cccccccccc00402c02802402001c01801401000c00880048848cc00400c008800448848cc00400c0084800448848cc00400c0084800448848cc00400c00848004848888c010014848888c00c014848888c008014848888c004014800448c88c008dd6000990009aa81c111999aab9f00125038233503730043574200460066ae880080c08c8c8c8cccd5cd19b8735573aa006900011998039919191999ab9a3370e6aae754009200023300d302e35742a00466a0200546ae84d5d1280111931a981a19ab9c038035033032135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a018eb8d5d09aba25002232635303033573806806205e05c26ae8940044d55cf280089baa00122212333001004003002200122123300100300220011335500175ceb44488c88c008dd5800990009aa81911191999aab9f002250332335032335502e300635573aa004600a6aae794008c010d5d100181589aba100112232323333573466e1d400520002350083005357426aae79400c8cccd5cd19b87500248008940208c98d4c0a8cd5ce01701581481401389aab9d500113754002242446004006224400224002464646666ae68cdc39aab9d5002480008cc018c01cd5d0a8011bad357426ae8940088c98d4c090cd5ce01401281181109aab9e50011375400244246600200600440024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6a604066ae7009008407c0784dd500089119191999ab9a3370ea00290021280391999ab9a3370ea004900111a80518031aba135573ca00846666ae68cdc3a801a40004a014464c6a604666ae7009c09008808408007c4d55cea80089baa00112122230030041122200211222001120012323333573466e1d40052002200623333573466e1d400920002006232635301b33573803e03803403203026aae74dd50008910010910009000919191919191999ab9a3370ea0029006100591999ab9a3370ea0049005100691999ab9a3370ea00690041198059bae35742a00a6eb4d5d09aba2500523333573466e1d4011200623300d375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846602460286ae854024dd71aba135744a01246666ae68cdc3a8032400446028602a6ae84d55cf280591999ab9a3370ea00e900011809980b1aba135573ca018464c6a604066ae7009008407c07807407006c0680640604d55cea80209aab9e500</p>

<offchain><developers>
Is there a way using the cardano emulator trace to stop loging all the Contract logs?
# Is there a way using the cardano emulator trace to stop loging all the Contract logs?

(Asked by: username_0 on 2022-07-17)

Im using the trace emulator, but the debug info that I print in the terminal using logInfo is completly lost in middle of hundreds of lines of contract logs made automaticaly by the emulator.

There is a way to set the level of verbose?

Here is an example how it looks:

Slot 00104: \*\*\* CONTRACT LOG: "CALCULATED Rewards: 3000000"  
Slot 00104: 00000000-0000-4000-8000-000000000002 {Wallet Wc30e}:
Contract log: Object (fromList [("mkTxLogLookups",Object (fromList [("slMPS",Array [Array [String "5abd1e1ba79c8ea981f2949126e186c1709b1c0a118be2a11648a3a8",Object (fromList [("getMintingPolicy",String "5908c0010000332332233322232323322332232323332223233322232333333332222222232333222323333222232323322323332223232323322332232323333322222332233223322332233223322332222232325335302f332235300a0012235300e002222222222233335302200b203f2333553059120013233505f223335350180032200200200135350160012200133501622533530400021042100103f235302b35301c0012200122235303000322335305500220462333573466e3c00406c11c11802c80fc80fccccd5cd19b8735573a6ea801120002047232635304633573809408e08a0886666ae68cdc39aab9d5002480008cc028c8c8c8c8c8c8c8c8c8c8c8cccd5cd19b8735573aa01490001199999999980c19a813119191999ab9a3370e6aae754009200023301e303635742a00460566ae84d5d1280111931a982b19ab9c05a057055054135573ca00226ea8004d5d0a80519a8130139aba150093335502d75ca0586ae854020ccd540b5d728161aba1500733502603f35742a00c66a04c66aa0a0090eb4d5d0a8029919191999ab9a3370e6aae754009200023350203232323333573466e1cd55cea80124000466a05066a07ceb4d5d0a80118219aba135744a004464c6a60b466ae7017816c1641604d55cf280089baa00135742a0046464646666ae68cdc39aab9d5002480008cd4098cd40f9d69aba150023043357426ae8940088c98d4c168cd5ce02f02d82c82c09aab9e5001137540026ae84d5d1280111931a982b19ab9c05a057055054135573ca00226ea8004d5d0a80219a8133ae35742a00666a04c66aa0a0eb88004d5d0a801181a9aba135744a004464c6a60a466ae7015814c1441404d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d55cf280089baa00135742a0046464646666ae68cdc3a800a400c4603a606e6ae84d55cf280191999ab9a3370ea00490021180e18209aba135573ca00846666ae68cdc3a801a40044603860586ae84d55cf280291999ab9a3370ea00890001180f9bae357426aae7940188c98d4c134cd5ce02882702602582502482409aab9d5001137540026ae84d5d1280111931a982319ab9c04a0470450441046132635304533573892010350543500046044135573ca00226ea800448848cc00400c008480048848cc00400c0088004888888888848cccccccccc00402c02802402001c01801401000c00880048848cc00400c008800448848cc00400c0084800448848cc00400c0084800448848cc00400c00848004848888c010014848888c00c014848888c008014848888c004014800448c88c008dd6000990009aa81c111999aab9f00125038233503730043574200460066ae880080c08c8c8c8cccd5cd19b8735573aa006900011998039919191999ab9a3370e6aae754009200023300d302e35742a00466a0200546ae84d5d1280111931a981a19ab9c038035033032135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a018eb8d5d09aba25002232635303033573806806205e05c26ae8940044d55cf280089baa00122212333001004003002200122123300100300220011335500175ceb44488c88c008dd5800990009aa81911191999aab9f002250332335032335502e300635573aa004600a6aae794008c010d5d100181589aba100112232323333573466e1d400520002350083005357426aae79400c8cccd5cd19b87500248008940208c98d4c0a8cd5ce01701581481401389aab9d500113754002242446004006224400224002464646666ae68cdc39aab9d5002480008cc018c01cd5d0a8011bad357426ae8940088c98d4c090cd5ce01401281181109aab9e50011375400244246600200600440024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6a604066ae7009008407c0784dd500089119191999ab9a3370ea00290021280391999ab9a3370ea004900111a80518031aba135573ca00846666ae68cdc3a801a40004a014464c6a604666ae7009c09008808408007c4d55cea80089baa00112122230030041122200211222001120012323333573466e1d40052002200623333573466e1d400920002006232635301b33573803e03803403203026aae74dd50008910010910009000919191919191999ab9a3370ea0029006100591999ab9a3370ea0049005100691999ab9a3370ea00690041198059bae35742a00a6eb4d5d09aba2500523333573466e1d4011200623300d375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846602460286ae854024dd71aba135744a01246666ae68cdc3a8032400446028602a6ae84d55cf280591999ab9a3370ea00e900011809980b1aba135573ca018464c6a604066ae7009008407c07807407006c0680640604d55cea80209aab9e500

**Tags:** offchain, developers

---

## 2 answers

### Answer by username_0 on 2023-03-18. Score: 0 | Accepted answer

I figured it out...
You can configure it with the 2nd parameter, TraceConfig, on the call runEmulatorTraceIO'.
https://play.marlowe-finance.io/doc/haddock/plutus-contract/html/Plutus-Trace-Emulator.html#t:TraceConfig
There you can put on the traceConfigMinLogLevel field MonadExtras.Info to Log only debug level info.
traceConfig = TraceEmulator.TraceConfig
  { 
    traceConfigShowEvent = traceConfigShowEventExample,
    -- ^ Function to decide how to print the particular events.
    traceConfigOutputHandle = SystemIO.stdout, -- withFile "/tmp/trace-log.txt" WriteMode $ \h -> h
    -- ^ Where to print the outputs to. Default: 'System.IO.stdout'
    traceConfigMinLogLevel = MonadExtras.Info
    -- Debug     
    -- Info  
    -- Notice    
    -- Warning   
    -- Error     
    -- Critical  
    -- Alert     
    -- Emergency
  }

traceConfigShowEventExample :: MonadExtras.LogMessage WalletEmulatorTypes.EmulatorEvent -> Maybe P.String
traceConfigShowEventExample (MonadExtras.LogMessage _minLogLevel (WalletEmulatorTypes.EmulatorTimeEvent slot e)) =
    let logMsgMaybe = case e of
          WalletEmulatorMultiAgent.UserThreadEvent (TraceEmulatorTypes.UserLog msg) ->
              Just $ "*** USER LOG: " <> msg
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog (TraceEmulatorTypes.ContractLog (DataAeson.String msg)) _ _) ->
              Just $ "*** CONTRACT LOG: " <> P.show msg
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog (TraceEmulatorTypes.StoppedWithError err)       _ _) ->
              Just $ "*** CONTRACT STOPPED WITH ERROR: " <> P.show err
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog TraceEmulatorTypes.NoRequestsHandled            _ _) ->
              Nothing
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog (TraceEmulatorTypes.HandledRequest _)           _ _) ->
              Nothing
          WalletEmulatorMultiAgent.InstanceEvent (TraceEmulatorTypes.ContractInstanceLog (TraceEmulatorTypes.CurrentRequests _)          _ _) ->
              Nothing
          WalletEmulatorMultiAgent.SchedulerEvent _ ->
              Nothing
          WalletEmulatorMultiAgent.WalletEvent _ _ ->
              Nothing
          ev ->
              Just . Prettyprinter.renderString . Prettyprinter.layoutPretty Prettyprinter.defaultLayoutOptions . Prettyprinter.pretty $ ev
        paddedSlotNo = pad 5 (Ledger.getSlot slot)
     in fmap (\m -> "Slot " <> paddedSlotNo <> ": " <> m) logMsgMaybe
 where
    pad :: P.Int -> Integer -> P.String
    pad n = (\x -> P.replicate (n P.- P.length x) '0' ++ x) . P.show


---

### Answer by username_1 on 2022-07-18. Score: 0

I also find the emulator trace way to verbose, so I prefer to use the pab simluator that has much better and concise debugging info. For info to run the simulator with working code you can check out my repository here:

<https://github.com/lley154/cardano-lottery#developer-testing>

> **Comments:**
> **username_0**: Thanks! Ill take a look! Sounds promising. I''ll mark this as an answer if it works as you said! I'm taking a look at your code.  
> **username_0**: it opens me a world using the pab simulator inspired in your code! thank you :)  
> **username_1**: great to hear it was helpful!  

---

