chore: remove configuration files and enhance blockchain explorer with advanced search, analytics, and export features
- Delete .aitbc.yaml.example CLI configuration template - Delete .lycheeignore link checker exclusion rules - Delete .nvmrc Node.js version specification - Add advanced search panel with filters for address, amount range, transaction type, time range, and validator - Add analytics dashboard with transaction volume, active addresses, and block time metrics - Add Chart.js integration
This commit is contained in:
43
apps/blockchain-node/src/aitbc_chain/logger.py
Normal file
43
apps/blockchain-node/src/aitbc_chain/logger.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import logging
|
||||
import sys
|
||||
from logging.handlers import RotatingFileHandler
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
class JsonFormatter(logging.Formatter):
|
||||
def format(self, record):
|
||||
log_record = {
|
||||
"timestamp": datetime.utcnow().isoformat() + "Z",
|
||||
"level": record.levelname,
|
||||
"logger": record.name,
|
||||
"message": record.getMessage()
|
||||
}
|
||||
|
||||
# Add any extra arguments passed to the logger
|
||||
if hasattr(record, "chain_id"):
|
||||
log_record["chain_id"] = record.chain_id
|
||||
if hasattr(record, "supported_chains"):
|
||||
log_record["supported_chains"] = record.supported_chains
|
||||
if hasattr(record, "height"):
|
||||
log_record["height"] = record.height
|
||||
if hasattr(record, "hash"):
|
||||
log_record["hash"] = record.hash
|
||||
if hasattr(record, "proposer"):
|
||||
log_record["proposer"] = record.proposer
|
||||
if hasattr(record, "error"):
|
||||
log_record["error"] = record.error
|
||||
|
||||
return json.dumps(log_record)
|
||||
|
||||
def get_logger(name: str) -> logging.Logger:
|
||||
logger = logging.getLogger(name)
|
||||
|
||||
if not logger.handlers:
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
# Console handler
|
||||
console_handler = logging.StreamHandler(sys.stdout)
|
||||
console_handler.setFormatter(JsonFormatter())
|
||||
logger.addHandler(console_handler)
|
||||
|
||||
return logger
|
||||
Reference in New Issue
Block a user