trying to fix logging

This commit is contained in:
2020-05-15 23:19:01 -05:00
parent 3bd9d24a97
commit 26340f118f
9 changed files with 66 additions and 39 deletions

View File

@ -30,7 +30,7 @@ def double_check_capsul_address(id, ipv4):
ipv4 = result.ipv4
get_model().update_vm_ip(email=session["account"], id=id, ipv4=result.ipv4)
except:
print(f"""
current_app.logger.error(f"""
the virtualization model threw an error in double_check_capsul_address of {id}:
{my_exec_info_message(sys.exc_info())}"""
)
@ -82,7 +82,7 @@ def detail(id):
return render_template("capsul-detail.html", vm=vm, delete=True, deleted=False)
else:
print(f"deleting {vm['id']} per user request ({session['account']})")
current_app.logger.info(f"deleting {vm['id']} per user request ({session['account']})")
current_app.config["VIRTUALIZATION_MODEL"].destroy(email=session['account'], id=id)
get_model().delete_vm(email=session['account'], id=id)
@ -182,7 +182,7 @@ def create():
flash(error)
if not capacity_avaliable:
print(f"when capsul capacity is restored, send an email to {session['account']}")
current_app.logger.warning(f"when capsul capacity is restored, send an email to {session['account']}")
return render_template(
"create-capsul.html",
@ -299,8 +299,7 @@ def account_balance():
for vm in get_vms():
end_datetime = vm["deleted"] if vm["deleted"] else datetime.utcnow()
# print(end_datetime)
# print(vm["created"])
vm_months = (end_datetime - vm["created"]).days / average_number_of_days_in_a_month
vms_billed.append(dict(
id=vm["id"],