ensure log file exists

This commit is contained in:
Dobromir Popov 2024-10-09 09:43:52 +03:00
parent 7bc36ddf44
commit 121a79245d

View File

@ -47,11 +47,10 @@ logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
# Set up error logger
error_file_handler = RotatingFileHandler(
'./logs/error.log',
maxBytes=10*1024*1024, # 10MB
backupCount=5
)
log_dir = './logs'
log_file = os.path.join(log_dir, 'error.log')
os.makedirs(log_dir, exist_ok=True)
error_file_handler = RotatingFileHandler( log_file, maxBytes=10*1024*1024, backupCount=5)
error_file_handler.setLevel(logging.ERROR)
error_file_handler.setFormatter(logging.Formatter('%(asctime)s [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S') )
error_logger = logging.getLogger('error_logger')
@ -1025,7 +1024,7 @@ async def follow_move(move):
signature = private_key.sign_message(message.to_bytes_versioned(raw_transaction.message))
signed_txn = VersionedTransaction.populate(raw_transaction.message, [signature])
opts = TxOpts(skip_preflight=False, preflight_commitment=Processed)
# send the transaction
result = await async_client.send_raw_transaction(txn=bytes(signed_txn), opts=opts)