Skip to content

Commit

Permalink
Add more configurable log level (#2241)
Browse files Browse the repository at this point in the history
  • Loading branch information
moisses89 authored Oct 16, 2024
1 parent 158d834 commit c2ff63f
Showing 1 changed file with 78 additions and 2 deletions.
80 changes: 78 additions & 2 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,35 @@
"EXCEPTION_HANDLER": "safe_transaction_service.history.exceptions.custom_exception_handler",
}

# INDEXER LOG LEVEL
ERC20_721_INDEXER_LOG_LEVEL = (
env("ERC20_INDEXER_LOG_LEVEL", default="INFO") if not DEBUG else "DEBUG"
)
PROXY_FACTORY_INDEXER_LOG_LEVEL = (
env("PROXY_FACTORY_INDEXER_LOG_LEVEL", default="INFO") if not DEBUG else "DEBUG"
)
SAFE_EVENTS_INDEXER_LOG_LEVEL = (
env("SAFE_EVENTS_INDEXER_LOG_LEVEL", default="INFO") if not DEBUG else "DEBUG"
)
INTERNAL_TX_INDEXER_LOG_LEVEL = (
env("INTERNAL_TX_INDEXER_LOG_LEVEL", default="INFO") if not DEBUG else "DEBUG"
)
# API LOG LEVEL
API_LOG_LEVEL = env("API_LOG_LEVEL", default="INFO") if not DEBUG else "DEBUG"
BALANCES_API_LOG_LEVEL = (
env("BALANCES_API_LOG_LEVEL", default="WARNING") if not DEBUG else "DEBUG"
)
MESSAGES_API_LOG_LEVEL = (
env("MESSAGES_API_LOG_LEVEL", default="INFO") if not DEBUG else "DEBUG"
)
ALL_TRANSACTIONS_API_LOG_LEVEL = (
env("ALL_TRANSACTIONS_API_LOG_LEVEL", default="INFO") if not DEBUG else "DEBUG"
)
COLLECTIBLES_API_LOG_LEVEL = (
env("COLLECTIBLES_API_LOG_LEVEL", default="WARNING") if not DEBUG else "DEBUG"
)


# LOGGING
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
Expand Down Expand Up @@ -396,11 +425,58 @@
"handlers": ["console"],
"propagate": False,
},
# BALANCES LOG
"safe_transaction_service.history.views.SafeBalanceView": {
"level": BALANCES_API_LOG_LEVEL,
},
"safe_transaction_service.history.services.balance_service": {
"level": "DEBUG" if DEBUG else "WARNING",
"level": BALANCES_API_LOG_LEVEL,
},
"safe_transaction_service.history.views_v2.SafeBalanceView": {
"level": BALANCES_API_LOG_LEVEL,
},
# COLLECTIBLES LOG
"safe_transaction_service.history.views_v2.SafeCollectiblesView": {
"level": COLLECTIBLES_API_LOG_LEVEL,
},
"safe_transaction_service.history.services.collectibles_service": {
"level": "DEBUG" if DEBUG else "WARNING",
"level": COLLECTIBLES_API_LOG_LEVEL,
},
# ALL-TRANSACTIONS LOG
"safe_transaction_service.history.views.AllTransactionsListView": {
"level": ALL_TRANSACTIONS_API_LOG_LEVEL,
},
"safe_transaction_service.history.services.transaction_service": {
"level": ALL_TRANSACTIONS_API_LOG_LEVEL,
},
# MESSAGES_API_LOG_LEVEL: NO LOGS FOR NOW
# ERC20_721_INDEXER_LOG_LEVEL
"safe_transaction_service.history.indexers.erc20_events_indexer": {
"level": ERC20_721_INDEXER_LOG_LEVEL,
},
"safe_transaction_service.history.tasks.index_erc20_events_task": {
"level": ERC20_721_INDEXER_LOG_LEVEL,
},
# PROXY_FACTORY_INDEXER_LOG_LEVEL
"safe_transaction_service.history.indexers.proxy_factory_indexer": {
"level": PROXY_FACTORY_INDEXER_LOG_LEVEL,
},
"safe_transaction_service.history.tasks.index_new_proxies_task": {
"level": PROXY_FACTORY_INDEXER_LOG_LEVEL,
},
# SAFE_EVENTS_INDEXER_LOG_LEVEL
"safe_transaction_service.history.indexers.safe_events_indexer": {
"level": SAFE_EVENTS_INDEXER_LOG_LEVEL,
},
"safe_transaction_service.history.tasks.index_safe_events_task": {
"level": SAFE_EVENTS_INDEXER_LOG_LEVEL,
},
# INTERNAL_TX_INDEXER_LOG_LEVEL
"safe_transaction_service.history.indexers.internal_tx_indexer": {
"level": INTERNAL_TX_INDEXER_LOG_LEVEL,
},
"safe_transaction_service.history.tasks.index_internal_txs_task": {
"level": INTERNAL_TX_INDEXER_LOG_LEVEL,
},
"celery": {
"handlers": ["console"],
Expand Down

0 comments on commit c2ff63f

Please sign in to comment.