You've already forked Mailu
mirror of
https://github.com/Mailu/Mailu.git
synced 2025-11-27 22:18:22 +02:00
Implement debug logging for template rendering
This commit is contained in:
@@ -2,11 +2,18 @@
|
||||
|
||||
import jinja2
|
||||
import os
|
||||
|
||||
convert = lambda src, dst, args: open(dst, "w").write(jinja2.Template(open(src).read()).render(**args))
|
||||
import logging as log
|
||||
import sys
|
||||
|
||||
args = os.environ.copy()
|
||||
|
||||
log.basicConfig(stream=sys.stderr, level=args["LOG_LEVEL"] if "LOG_LEVEL" in args else "WARN")
|
||||
|
||||
def convert(src, dst, args):
|
||||
logger = log.getLogger("convert()")
|
||||
logger.debug("Source: %s, Destination: %s", src, dst)
|
||||
open(dst, "w").write(jinja2.Template(open(src).read()).render(**args))
|
||||
|
||||
# Get the first DNS server
|
||||
with open("/etc/resolv.conf") as handle:
|
||||
content = handle.read().split()
|
||||
|
||||
Reference in New Issue
Block a user