Skip to content

Commit 8ff3f8d

Browse files
committed
use iohk-monitoring Severity to handle debug
1 parent e799ab3 commit 8ff3f8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+594
-406
lines changed

Diff for: cardano-chain-gen/cardano-chain-gen.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ test-suite cardano-chain-gen
195195
, esqueleto
196196
, extra
197197
, filepath
198+
, iohk-monitoring
198199
, silently
199200
, stm
200201
, strict-stm

Diff for: cardano-chain-gen/test/Test/Cardano/Db/Mock/Config.hs

+4-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ import Ouroboros.Consensus.Shelley.Node (ShelleyLeaderCredentials)
101101
import System.Directory (createDirectoryIfMissing, removePathForcibly)
102102
import System.FilePath.Posix (takeDirectory, (</>))
103103
import System.IO.Silently (hSilence)
104+
import qualified Cardano.BM.Data.Severity as BM
104105

105106
data Config = Config
106107
{ topLevelConfig :: TopLevelConfig CardanoBlock
@@ -555,12 +556,14 @@ withFullConfig' WithConfigArgs {..} cmdLineArgs mSyncNodeConfig configFilePath t
555556
cfg <- mkConfig configFilePath mutableDir cmdLineArgs syncNodeConfig
556557
fingerFile <- if hasFingerprint then Just <$> prepareFingerprintFile testLabelFilePath else pure Nothing
557558
let dbsyncParams = syncNodeParams cfg
559+
-- if shouldLog is True, we will log at Debug level
560+
debugLogs = if shouldLog then BM.Debug else BM.Info
558561
trce <-
559562
if shouldLog
560563
then configureLogging syncNodeConfig "db-sync-node"
561564
else pure nullTracer
562565
-- runDbSync is partially applied so we can pass in syncNodeParams at call site / within tests
563-
let partialDbSyncRun params cfg' = runDbSync emptyMetricsSetters migr iom trce params cfg' True
566+
let partialDbSyncRun params cfg' = runDbSync emptyMetricsSetters migr iom trce debugLogs params cfg' True
564567
initSt = Consensus.pInfoInitLedger $ protocolInfo cfg
565568

566569
withInterpreter (protocolInfoForging cfg) (protocolInfoForger cfg) nullTracer fingerFile $ \interpreter -> do

Diff for: cardano-db-sync/cardano-db-sync.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ library
4343
exposed-modules: Cardano.DbSync
4444

4545
Cardano.DbSync.Api
46+
Cardano.DbSync.Api.Functions
4647
Cardano.DbSync.Api.Ledger
4748
Cardano.DbSync.Api.Types
4849
Cardano.DbSync.Config

Diff for: cardano-db-sync/src/Cardano/DbSync.hs

+21-15
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,33 @@ import Ouroboros.Network.NodeToClient (IOManager, withIOManager)
5858
import Paths_cardano_db_sync (version)
5959
import System.Directory (createDirectoryIfMissing)
6060
import Prelude (id)
61+
import qualified Cardano.BM.Configuration as BM
62+
import qualified Cardano.BM.Data.Severity as BM
6163

6264
runDbSyncNode :: MetricSetters -> [(Text, Text)] -> SyncNodeParams -> SyncNodeConfig -> IO ()
6365
runDbSyncNode metricsSetters knownMigrations params syncNodeConfigFromFile =
6466
withIOManager $ \iomgr -> do
67+
severity <- BM.minSeverity . dncLoggingConfig $ syncNodeConfigFromFile
6568
trce <- configureLogging syncNodeConfigFromFile "db-sync-node"
6669

6770
abortOnPanic <- hasAbortOnPanicEnv
68-
startupReport trce abortOnPanic params
71+
startupReport trce severity abortOnPanic params
6972

70-
runDbSync metricsSetters knownMigrations iomgr trce params syncNodeConfigFromFile abortOnPanic
73+
runDbSync metricsSetters knownMigrations iomgr trce severity params syncNodeConfigFromFile abortOnPanic
7174

7275
runDbSync ::
7376
MetricSetters ->
7477
[(Text, Text)] ->
7578
IOManager ->
7679
Trace IO Text ->
80+
BM.Severity ->
7781
SyncNodeParams ->
7882
SyncNodeConfig ->
7983
-- Should abort on panic
8084
Bool ->
8185
IO ()
82-
runDbSync metricsSetters knownMigrations iomgr trce params syncNodeConfigFromFile abortOnPanic = do
83-
let logCtx = initLogCtx "runDbSync" "Cardano.DbSync"
86+
runDbSync metricsSetters knownMigrations iomgr trce severity params syncNodeConfigFromFile abortOnPanic = do
87+
let logCtx = initLogCtx severity "runDbSync" "Cardano.DbSync"
8488
logInfoCtx trce $ logCtx {lcMessage = "Current sync options: " <> textShow syncOpts}
8589

8690
-- Read the PG connection info
@@ -128,10 +132,11 @@ runDbSync metricsSetters knownMigrations iomgr trce params syncNodeConfigFromFil
128132

129133
-- For testing and debugging.
130134
whenJust (enpMaybeRollback params) $ \slotNo ->
131-
void $ unsafeRollback trce (txOutConfigToTableType txOutConfig) pgConfig slotNo
135+
void $ unsafeRollback trce severity (txOutConfigToTableType txOutConfig) pgConfig slotNo
132136
runSyncNode
133137
metricsSetters
134138
trce
139+
severity
135140
iomgr
136141
connectionString
137142
ranMigrations
@@ -160,6 +165,7 @@ runDbSync metricsSetters knownMigrations iomgr trce params syncNodeConfigFromFil
160165
runSyncNode ::
161166
MetricSetters ->
162167
Trace IO Text ->
168+
BM.Severity ->
163169
IOManager ->
164170
ConnectionString ->
165171
-- | migrations were ran on startup
@@ -170,8 +176,8 @@ runSyncNode ::
170176
SyncNodeParams ->
171177
SyncOptions ->
172178
IO ()
173-
runSyncNode metricsSetters trce iomgr dbConnString ranMigrations runMigrationFnc syncNodeConfigFromFile syncNodeParams syncOptions = do
174-
let logCtx = initLogCtx "runSyncNode" "Cardano.DbSync"
179+
runSyncNode metricsSetters trce severity iomgr dbConnString ranMigrations runMigrationFnc syncNodeConfigFromFile syncNodeParams syncOptions = do
180+
let logCtx = initLogCtx severity "runSyncNode" "Cardano.DbSync"
175181
whenJust maybeLedgerDir $
176182
\enpLedgerStateDir -> do
177183
createDirectoryIfMissing True (unLedgerStateDir enpLedgerStateDir)
@@ -190,7 +196,7 @@ runSyncNode metricsSetters trce iomgr dbConnString ranMigrations runMigrationFnc
190196
runOrThrowIO $ runExceptT $ do
191197
genCfg <- readCardanoGenesisConfig syncNodeConfigFromFile
192198
isJsonbInSchema <- queryIsJsonbInSchema backend
193-
logProtocolMagicId trce $ genesisProtocolMagicId genCfg
199+
logProtocolMagicId trce severity $ genesisProtocolMagicId genCfg
194200
syncEnv <-
195201
ExceptT $
196202
mkSyncEnvFromConfig
@@ -228,7 +234,7 @@ runSyncNode metricsSetters trce iomgr dbConnString ranMigrations runMigrationFnc
228234
, runSyncNodeClient metricsSetters syncEnv iomgr trce threadChannels (enpSocketPath syncNodeParams)
229235
, runFetchOffChainPoolThread syncEnv
230236
, runFetchOffChainVoteThread syncEnv
231-
, runLedgerStateWriteThread (getTrace syncEnv) (envLedgerEnv syncEnv)
237+
, runLedgerStateWriteThread (getTrace syncEnv) severity (envLedgerEnv syncEnv)
232238
]
233239
where
234240
useShelleyInit :: SyncNodeConfig -> Bool
@@ -239,9 +245,9 @@ runSyncNode metricsSetters trce iomgr dbConnString ranMigrations runMigrationFnc
239245
removeJsonbFromSchemaConfig = ioRemoveJsonbFromSchema $ soptInsertOptions syncOptions
240246
maybeLedgerDir = enpMaybeLedgerStateDir syncNodeParams
241247

242-
logProtocolMagicId :: Trace IO Text -> Crypto.ProtocolMagicId -> ExceptT SyncNodeError IO ()
243-
logProtocolMagicId tracer pm = do
244-
let logCtx = initLogCtx "logProtocolMagicId" "Cardano.DbSync"
248+
logProtocolMagicId :: Trace IO Text -> BM.Severity -> Crypto.ProtocolMagicId -> ExceptT SyncNodeError IO ()
249+
logProtocolMagicId tracer severity pm = do
250+
let logCtx = initLogCtx severity "logProtocolMagicId" "Cardano.DbSync"
245251
liftIO
246252
. logInfoCtx tracer
247253
$ logCtx
@@ -314,9 +320,9 @@ extractSyncOptions snp aop snc =
314320
forceTxIn' = forceTxIn . sioTxOut . dncInsertOptions $ snc
315321
ioTxOutTableType' = txOutConfigToTableType $ sioTxOut $ dncInsertOptions snc
316322

317-
startupReport :: Trace IO Text -> Bool -> SyncNodeParams -> IO ()
318-
startupReport trce aop params = do
319-
let logCtx = initLogCtx "runSyncNode" "Cardano.DbSync"
323+
startupReport :: Trace IO Text -> BM.Severity -> Bool -> SyncNodeParams -> IO ()
324+
startupReport trce severity aop params = do
325+
let logCtx = initLogCtx severity "runSyncNode" "Cardano.DbSync"
320326
logInfoCtx trce $ logCtx {lcMessage = mconcat ["Version number: ", Text.pack (showVersion version)]}
321327
logInfoCtx trce $ logCtx {lcMessage = mconcat ["Git hash: ", Db.gitRev]}
322328
logInfoCtx trce $ logCtx {lcMessage = mconcat ["Enviroment variable DbSyncAbortOnPanic: ", textShow aop]}

Diff for: cardano-db-sync/src/Cardano/DbSync/Api.hs

+23-15
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,16 @@ import Ouroboros.Consensus.Protocol.Abstract (ConsensusProtocol)
9999
import Ouroboros.Network.Block (BlockNo (..), Point (..))
100100
import Ouroboros.Network.Magic (NetworkMagic (..))
101101
import qualified Ouroboros.Network.Point as Point
102+
import qualified Cardano.BM.Data.Severity as BM
103+
import qualified Cardano.BM.Configuration.Model as BM
104+
import Cardano.DbSync.Api.Functions (getSeverity)
102105

103106
setConsistentLevel :: SyncEnv -> ConsistentLevel -> IO ()
104-
setConsistentLevel env cst = do
105-
let logCtx = initLogCtx "setConsistentLevel" "Cardano.DbSync.Api"
106-
logInfoCtx (getTrace env) $ logCtx {lcMessage = "Setting ConsistencyLevel to " <> textShow cst}
107-
atomically $ writeTVar (envConsistentLevel env) cst
107+
setConsistentLevel syncEnv cst = do
108+
severity <- getSeverity syncEnv
109+
let logCtx = initLogCtx severity "setConsistentLevel" "Cardano.DbSync.Api"
110+
logInfoCtx (getTrace syncEnv) $ logCtx {lcMessage = "Setting ConsistencyLevel to " <> textShow cst}
111+
atomically $ writeTVar (envConsistentLevel syncEnv) cst
108112

109113
getConsistentLevel :: SyncEnv -> IO ConsistentLevel
110114
getConsistentLevel env =
@@ -159,13 +163,14 @@ getRanIndexes env = do
159163
readTVarIO $ envIndexes env
160164

161165
runIndexMigrations :: SyncEnv -> IO ()
162-
runIndexMigrations env = do
163-
let logCtx = initLogCtx "runIndexMigrations" "Cardano.DbSync.Api"
164-
haveRan <- readTVarIO $ envIndexes env
166+
runIndexMigrations syncEnv = do
167+
severity <- getSeverity syncEnv
168+
let logCtx = initLogCtx severity "runIndexMigrations" "Cardano.DbSync.Api"
169+
haveRan <- readTVarIO $ envIndexes syncEnv
165170
unless haveRan $ do
166-
envRunDelayedMigration env DB.Indexes
167-
logInfoCtx (getTrace env) $ logCtx {lcMessage = "Indexes were created"}
168-
atomically $ writeTVar (envIndexes env) True
171+
envRunDelayedMigration syncEnv DB.Indexes
172+
logInfoCtx (getTrace syncEnv) $ logCtx {lcMessage = "Indexes were created"}
173+
atomically $ writeTVar (envIndexes syncEnv) True
169174

170175
initPruneConsumeMigration :: Bool -> Bool -> Bool -> Bool -> DB.PruneConsumeMigration
171176
initPruneConsumeMigration consumed pruneTxOut bootstrap forceTxIn' =
@@ -180,8 +185,9 @@ getPruneConsume = soptPruneConsumeMigration . envOptions
180185

181186
runExtraMigrationsMaybe :: SyncEnv -> IO ()
182187
runExtraMigrationsMaybe syncEnv = do
188+
severity <- getSeverity syncEnv
183189
let pcm = getPruneConsume syncEnv
184-
logCtx = initLogCtx "runExtraMigrationsMaybe" "Cardano.DbSync.Api"
190+
logCtx = initLogCtx severity "runExtraMigrationsMaybe" "Cardano.DbSync.Api"
185191
txOutTableType = getTxOutTableType syncEnv
186192
logInfoCtx (getTrace syncEnv) $ logCtx {lcMessage = "runExtraMigrationsMaybe: " <> textShow pcm}
187193
DB.runDbIohkNoLogging (envBackend syncEnv) $
@@ -355,7 +361,8 @@ mkSyncEnv ::
355361
RunMigration ->
356362
IO SyncEnv
357363
mkSyncEnv trce backend connectionString syncOptions protoInfo nw nwMagic systemStart syncNodeConfigFromFile syncNP ranMigrations runMigrationFnc = do
358-
let logCtx = initLogCtx "mkSyncEnv" "Cardano.DbSync.Api"
364+
severity <- BM.minSeverity . dncLoggingConfig $ syncNodeConfigFromFile
365+
let logCtx = initLogCtx severity "mkSyncEnv" "Cardano.DbSync.Api"
359366
dbCNamesVar <- newTVarIO =<< dbConstraintNamesExists backend
360367
cache <-
361368
if soptCache syncOptions
@@ -371,7 +378,7 @@ mkSyncEnv trce backend connectionString syncOptions protoInfo nw nwMagic systemS
371378
consistentLevelVar <- newTVarIO Unchecked
372379
fixDataVar <- newTVarIO $ if ranMigrations then DataFixRan else NoneFixRan
373380
indexesVar <- newTVarIO $ enpForceIndexes syncNP
374-
bts <- getBootstrapInProgress trce (isTxOutConsumedBootstrap' syncNodeConfigFromFile) backend
381+
bts <- getBootstrapInProgress trce severity (isTxOutConsumedBootstrap' syncNodeConfigFromFile) backend
375382
bootstrapVar <- newTVarIO bts
376383
-- Offline Pool + Anchor queues
377384
opwq <- newTBQueueIO 1000
@@ -543,11 +550,12 @@ getMaxRollbacks = maxRollbacks . configSecurityParam . pInfoConfig
543550

544551
getBootstrapInProgress ::
545552
Trace IO Text ->
553+
BM.Severity ->
546554
Bool ->
547555
SqlBackend ->
548556
IO Bool
549-
getBootstrapInProgress trce bootstrapFlag sqlBackend = do
550-
let logCtx = initLogCtx "getBootstrapInProgress" "Cardano.DbSync.Api"
557+
getBootstrapInProgress trce severity bootstrapFlag sqlBackend = do
558+
let logCtx = initLogCtx severity "getBootstrapInProgress" "Cardano.DbSync.Api"
551559
DB.runDbIohkNoLogging sqlBackend $ do
552560
ems <- DB.queryAllExtraMigrations
553561
let btsState = DB.bootstrapState ems

Diff for: cardano-db-sync/src/Cardano/DbSync/Api/Functions.hs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Cardano.DbSync.Api.Functions (
2+
getSeverity,
3+
) where
4+
import Cardano.DbSync.Api.Types (SyncEnv (..))
5+
import qualified Cardano.BM.Data.Severity as BM
6+
import qualified Cardano.BM.Configuration.Model as BM
7+
import Cardano.DbSync.Config.Types (SyncNodeConfig(..))
8+
9+
getSeverity :: SyncEnv -> IO BM.Severity
10+
getSeverity = BM.minSeverity . dncLoggingConfig . envSyncNodeConfig

Diff for: cardano-db-sync/src/Cardano/DbSync/Api/Ledger.hs

+16-9
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import Numeric
4747
import Ouroboros.Consensus.Cardano.Block hiding (CardanoBlock)
4848
import Ouroboros.Consensus.Ledger.Extended (ExtLedgerState, ledgerState)
4949
import qualified Ouroboros.Consensus.Shelley.Ledger.Ledger as Consensus
50+
import Cardano.DbSync.Api.Functions (getSeverity)
5051

5152
bootStrapMaybe ::
5253
(MonadBaseControl IO m, MonadIO m) =>
@@ -61,6 +62,8 @@ migrateBootstrapUTxO ::
6162
SyncEnv ->
6263
ExceptT SyncNodeError (ReaderT SqlBackend m) ()
6364
migrateBootstrapUTxO syncEnv = do
65+
severity <- liftIO $ getSeverity syncEnv
66+
let logCtx = initLogCtx severity "migrateBootstrapUTxO" "Cardano.DbSync.Api.Ledger"
6467
case envLedgerEnv syncEnv of
6568
HasLedger lenv -> do
6669
liftIO $ logInfoCtx trce logCtx {lcMessage = "Starting UTxO bootstrap migration"}
@@ -77,16 +80,17 @@ migrateBootstrapUTxO syncEnv = do
7780
NoLedger _ ->
7881
liftIO $ logWarningCtx trce $ logCtx {lcMessage = "Tried to bootstrap, but ledger state is not enabled. Please stop db-sync and restart without --disable-ledger-state"}
7982
where
80-
logCtx = initLogCtx "migrateBootstrapUTxO" "Cardano.DbSync.Api.Ledger"
8183
trce = getTrace syncEnv
8284

8385
storeUTxOFromLedger :: (MonadBaseControl IO m, MonadIO m) => SyncEnv -> ExtLedgerState CardanoBlock -> ExceptT SyncNodeError (ReaderT SqlBackend m) ()
84-
storeUTxOFromLedger env st = case ledgerState st of
85-
LedgerStateBabbage bts -> storeUTxO env (getUTxO bts)
86-
LedgerStateConway stc -> storeUTxO env (getUTxO stc)
87-
_otherwise -> liftIO $ logErrorCtx trce logCtx {lcMessage = "storeUTxOFromLedger is only supported after Babbage"}
86+
storeUTxOFromLedger env st = do
87+
severity <- liftIO $ getSeverity env
88+
let logCtx = initLogCtx severity "storeUTxOFromLedger" "Cardano.DbSync.Api.Ledger"
89+
case ledgerState st of
90+
LedgerStateBabbage bts -> storeUTxO env (getUTxO bts)
91+
LedgerStateConway stc -> storeUTxO env (getUTxO stc)
92+
_otherwise -> liftIO $ logErrorCtx trce logCtx {lcMessage = "storeUTxOFromLedger is only supported after Babbage"}
8893
where
89-
logCtx = initLogCtx "storeUTxOFromLedger" "Cardano.DbSync.Api.Ledger"
9094
trce = getTrace env
9195
getUTxO st' =
9296
unUTxO $ Consensus.shelleyLedgerState st' ^. (nesEsL . esLStateL . lsUTxOStateL . utxosUtxoL)
@@ -109,6 +113,8 @@ storeUTxO ::
109113
Map (TxIn StandardCrypto) (BabbageTxOut era) ->
110114
ExceptT SyncNodeError (ReaderT SqlBackend m) ()
111115
storeUTxO env mp = do
116+
severity <- liftIO $ getSeverity env
117+
let logCtx = initLogCtx severity "storeUTxO" "Cardano.DbSync.Api.Ledger"
112118
liftIO $
113119
logInfoCtx trce $
114120
logCtx
@@ -122,7 +128,6 @@ storeUTxO env mp = do
122128
}
123129
mapM_ (storePage env pagePerc) . zip [0 ..] . chunksOf pageSize . Map.toList $ mp
124130
where
125-
logCtx = initLogCtx "storeUTxO" "Cardano.DbSync.Api.Ledger"
126131
trce = getTrace env
127132
npages = size `div` pageSize
128133
pagePerc :: Float = if npages == 0 then 100.0 else 100.0 / fromIntegral npages
@@ -144,14 +149,15 @@ storePage ::
144149
(Int, [(TxIn StandardCrypto, BabbageTxOut era)]) ->
145150
ExceptT SyncNodeError (ReaderT SqlBackend m) ()
146151
storePage syncEnv percQuantum (n, ls) = do
152+
severity <- liftIO $ getSeverity syncEnv
153+
let logCtx = initLogCtx severity "storePage" "Cardano.DbSync.Api.Ledger"
147154
when (n `mod` 10 == 0) $ liftIO $ logInfoCtx trce $ logCtx {lcMessage = "Bootstrap in progress " <> prc <> "%"}
148155
txOuts <- mapM (prepareTxOut syncEnv) ls
149156
txOutIds <-
150157
lift . DB.insertManyTxOut False $ etoTxOut . fst <$> txOuts
151158
let maTxOuts = concatMap (mkmaTxOuts txOutTableType) $ zip txOutIds (snd <$> txOuts)
152159
void . lift $ DB.insertManyMaTxOut maTxOuts
153160
where
154-
logCtx = initLogCtx "storePage" "Cardano.DbSync.Api.Ledger"
155161
txOutTableType = getTxOutTableType syncEnv
156162
trce = getTrace syncEnv
157163
prc = Text.pack $ showGFloat (Just 1) (max 0 $ min 100.0 (fromIntegral n * percQuantum)) ""
@@ -171,10 +177,11 @@ prepareTxOut ::
171177
(TxIn StandardCrypto, BabbageTxOut era) ->
172178
ExceptT SyncNodeError (ReaderT SqlBackend m) (ExtendedTxOut, [MissingMaTxOut])
173179
prepareTxOut syncEnv (TxIn txIntxId (TxIx index), txOut) = do
180+
severity <- liftIO $ getSeverity syncEnv
174181
let txHashByteString = Generic.safeHashToByteString $ unTxId txIntxId
175182
let genTxOut = fromTxOut index txOut
176183
txId <- liftLookupFail "prepareTxOut" $ queryTxIdWithCache cache txIntxId
177-
insertTxOut trce cache iopts (txId, txHashByteString) genTxOut
184+
insertTxOut trce severity cache iopts (txId, txHashByteString) genTxOut
178185
where
179186
trce = getTrace syncEnv
180187
cache = envCache syncEnv

Diff for: cardano-db-sync/src/Cardano/DbSync/Api/Types.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Cardano.DbSync.Api.Types (
1515

1616
import qualified Cardano.Db as DB
1717
import Cardano.DbSync.Cache.Types (CacheStatus)
18-
import Cardano.DbSync.Config.Types (SyncNodeConfig)
18+
import Cardano.DbSync.Config.Types (SyncNodeConfig (..))
1919
import Cardano.DbSync.Ledger.Types (HasLedgerEnv)
2020
import Cardano.DbSync.LocalStateQuery (NoLedgerEnv)
2121
import Cardano.DbSync.Types (

Diff for: cardano-db-sync/src/Cardano/DbSync/Cache.hs

+7-4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import Data.Either.Combinators
5656
import qualified Data.Map.Strict as Map
5757
import Database.Persist.Postgresql (SqlBackend)
5858
import Ouroboros.Consensus.Cardano.Block (StandardCrypto)
59+
import qualified Cardano.BM.Data.Severity as BM
5960

6061
-- Rollbacks make everything harder and the same applies to caching.
6162
-- After a rollback db entries are deleted, so we need to clean the same
@@ -275,13 +276,14 @@ queryPoolKeyOrInsert ::
275276
(MonadBaseControl IO m, MonadIO m) =>
276277
Text ->
277278
Trace IO Text ->
279+
BM.Severity ->
278280
CacheStatus ->
279281
CacheAction ->
280282
Bool ->
281283
PoolKeyHash ->
282284
ReaderT SqlBackend m DB.PoolHashId
283-
queryPoolKeyOrInsert txt trce cache cacheUA logsWarning hsh = do
284-
let logCtx = initLogCtx "queryPoolKeyOrInsert" "Cardano.DbSync.Cache"
285+
queryPoolKeyOrInsert txt trce severity cache cacheUA logsWarning hsh = do
286+
let logCtx = initLogCtx severity "queryPoolKeyOrInsert" "Cardano.DbSync.Cache"
285287
pk <- queryPoolKeyWithCache cache cacheUA hsh
286288
case pk of
287289
Right poolHashId -> pure poolHashId
@@ -306,12 +308,13 @@ queryPoolKeyOrInsert txt trce cache cacheUA logsWarning hsh = do
306308
queryMAWithCache ::
307309
MonadIO m =>
308310
Trace IO Text ->
311+
BM.Severity ->
309312
CacheStatus ->
310313
PolicyID StandardCrypto ->
311314
AssetName ->
312315
ReaderT SqlBackend m (Either (ByteString, ByteString) DB.MultiAssetId)
313-
queryMAWithCache trce cache policyId asset = do
314-
let logCtx = initLogCtx "queryMAWithCache" "Cardano.DbSync.Cache"
316+
queryMAWithCache trce severity cache policyId asset = do
317+
let logCtx = initLogCtx severity "queryMAWithCache" "Cardano.DbSync.Cache"
315318
case cache of
316319
NoCache -> do
317320
let !policyBs = Generic.unScriptHash $ policyID policyId

0 commit comments

Comments
 (0)