Skip to content

Commit

Permalink
fixed logger format
Browse files Browse the repository at this point in the history
  • Loading branch information
mietzen committed Jul 23, 2023
1 parent b077024 commit 8c16e76
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions porkbun_ddns/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
import logging
from .porkbun_ddns import PorkbunDDNS, PorkbunDDNS_Error

logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logging.Formatter('%(message)s')

logger = logging.getLogger('porkbun_ddns')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)


def main(argv=sys.argv[1:]):
Expand Down Expand Up @@ -52,7 +57,8 @@ def main(argv=sys.argv[1:]):
porkbun_ddns = PorkbunDDNS(config=args.config, domain=args.domain,
public_ips=args.public_ips, fritzbox_ip=args.fritzbox,
ipv4=ipv4, ipv6=ipv6)
porkbun_ddns.set_subdomain(args.subdomain)
if args.subdomain:
porkbun_ddns.set_subdomain(args.subdomain)
porkbun_ddns.update_records()
except PorkbunDDNS_Error as e:
logger.error("Error: " + str(e))
Expand Down

0 comments on commit 8c16e76

Please sign in to comment.