mirror of
https://git.auk.su/Dinect/bonus-import-tools.git
synced 2025-12-28 18:10:01 +00:00
fixed logging
This commit is contained in:
9
app.py
9
app.py
@@ -85,6 +85,8 @@ def run_import():
|
||||
try:
|
||||
print(f'Processing line {line_count}: {row}')
|
||||
nickname, full_name, card, phone, email, gender = row
|
||||
print(nickname, full_name, card, phone, email, gender)
|
||||
log_file.write(f'String: [{line_count}]- {nickname}, {full_name}, {card}, {phone}, {email}, {gender}\n')
|
||||
|
||||
# strip whitespaces
|
||||
nickname = nickname.strip()
|
||||
@@ -148,10 +150,13 @@ def run_import():
|
||||
)
|
||||
if user_created:
|
||||
print('User created with', data['ID'], data['DIN'])
|
||||
log_file.write(f'Line: [{line_count}]- User created with: {data}\n')
|
||||
else:
|
||||
log_file.write(f'error in line: [{line_count}]- Invalid user data: {data}\n')
|
||||
log_file.write(f'error creating user in line: [{line_count}]- Invalid user data: {data}\n')
|
||||
else:
|
||||
print('User found with', data['DIN'], user_card)
|
||||
log_file.write(f'Line: [{line_count}]- User found with: {data}\n')
|
||||
print('User found with ',user_card, data)
|
||||
# print('User found with', data['DIN'], user_card)
|
||||
|
||||
end_time = time.time()
|
||||
print(f'Elapsed time of USERS file processing : {end_time - start_time} seconds')
|
||||
|
||||
Reference in New Issue
Block a user