Skip to content

Commit

Permalink
client log file rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejka committed Oct 25, 2024
1 parent cb6da9a commit 38f40e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion scripts/data/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import random
from generate_data import generate_data
from format_args import format_args
import logging
from logging.handlers import TimedRotatingFileHandler

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -290,7 +292,14 @@ def main(start, blocks, step, mode, strategy):

MAX_WEIGHT_LIMIT = args.maxweight

file_handler = logging.FileHandler("client.errors.log")
# file_handler = logging.FileHandler("client.log")
file_handler = TimedRotatingFileHandler(
filename="client.log",
when="midnight",
interval=1,
backupCount=14,
encoding="utf8"
)
file_handler.setLevel(logging.INFO)
file_handler.setFormatter(
logging.Formatter("%(asctime)s - %(name)-10.10s - %(levelname)s - %(message)s")
Expand Down
2 changes: 1 addition & 1 deletion scripts/data/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ for test_file in "${test_files[@]}"; do
echo " ignored"
num_ignored=$((num_ignored + 1))
else
arguments_file=".arguments-$(basename "$test_file")"
arguments_file="$(dirname "$test_file")/.arguments-$(basename "$test_file")"
python ../../scripts/data/format_args.py --input_file ${test_file} $([[ $execute_scripts -eq 1 ]] && echo "--execute_script") > $arguments_file
output=$(scarb cairo-run --no-build --function main --arguments-file $arguments_file)
gas_spent=$(echo $output | grep -o 'gas_spent=[0-9]*' | sed 's/gas_spent=//')
Expand Down

0 comments on commit 38f40e0

Please sign in to comment.