Skip to content

Commit

Permalink
slight improvement to configurable log level
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed May 30, 2024
1 parent 8f415fd commit 2821db7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
network = "testnet"
# gas station contract account id
contract_id = "canhazgas.testnet"
log_level = "info"
5 changes: 3 additions & 2 deletions gas_station_event_indexer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import asyncio
import logging
import json
import os
from dataclasses import dataclass, fields
Expand All @@ -21,8 +22,8 @@

REQUEST_TIMEOUT = 10
ParsedLog = dict[str, Any]

logging = set_logger(__name__)
LOG_LEVEL = logging.INFO
logging = set_logger(__name__, LOG_LEVEL)


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def get_ignored_message(self) -> str:
return self.ignored_message


def set_logger(name: str) -> logging.Logger:
logging.basicConfig(level=logging.INFO)
def set_logger(name: str, level: int) -> logging.Logger:
logging.basicConfig(level=level)
logging.getLogger("near_lake_framework").setLevel(logging.INFO)
missing_shard_filter = IgnoreFilter("doesn't exist")
logging.getLogger().addFilter(missing_shard_filter)
Expand Down

0 comments on commit 2821db7

Please sign in to comment.