Logging with loguru (#708)

* logging

* requirements

* add loguru dependency

* restore it

* add loguru

* set log level in .env file

* remove service fee print

* set log level

* more logging

* more logging

* more logging

* pyament.checking_id

* fix
This commit is contained in:
calle
2022-07-07 14:30:16 +02:00
committed by GitHub
parent 847fd18796
commit 089313f613
40 changed files with 202 additions and 81 deletions
+4 -2
View File
@@ -1,6 +1,8 @@
from datetime import datetime, timedelta
from typing import List, Optional, Union
from loguru import logger
from lnbits.helpers import urlsafe_short_hash
from . import db
@@ -186,9 +188,9 @@ async def purge_addresses(domain_id: str):
) # give user 1 day to topup is address
if not paid and pay_expire:
print("DELETE UNP_PAY_EXP", r["username"])
logger.debug("DELETE UNP_PAY_EXP", r["username"])
await delete_address(r["id"])
if paid and expired:
print("DELETE PAID_EXP", r["username"])
logger.debug("DELETE PAID_EXP", r["username"])
await delete_address(r["id"])
+4 -2
View File
@@ -3,6 +3,9 @@ import json
from datetime import datetime, timedelta
import httpx
from loguru import logger
from fastapi.params import Query
from lnurl import ( # type: ignore
LnurlErrorResponse,
@@ -38,13 +41,12 @@ async def lnurl_response(username: str, domain: str, request: Request):
"maxSendable": 1000000000,
}
print("RESP", resp)
logger.debug("RESP", resp)
return resp
@lnaddress_ext.get("/lnurl/cb/{address_id}", name="lnaddress.lnurl_callback")
async def lnurl_callback(address_id, amount: int = Query(...)):
print("PING")
address = await get_address(address_id)
if not address:
return LnurlErrorResponse(reason=f"Address not found").dict()