tiredofit / docker-traefik-cloudflare-companion

Automatically Create CNAME records for containers served by Traefik

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider using pythons logging modules instead of prints

mbjurstrom opened this issue · comments

Implementing and using pythons logging module instead of prints feels a lot more flexible and more pythonic.

It also give cleaner code as we can remove a lot of if CONTAINER_LOG_LEVEL == "DEBUG":

See mbjurstrom@ac36ae6 for inspiration.

Looks much cleaner to my eyes. But not sure what your opinion is about that.
If there is any interest I am happy to supply a PR without the rest of the of the additions I added in that branch. Most of them is in existing open PRs from me or other people.

Huge yes. This also gives the opportunity to log to a file as opposed to console as well and implement logrotation from the included base image.

I'm more than happy to take as much PRs as possible from someone who has better Python skills than me. This is my first project in Python and I'm doing things in some pretty unoptimized ways. I do plan on merging the other PRs later on today.

Glad to know that you are so positive:)
Some developers don't like when you start submitting a lot of PRs.
I am no python expert myself, but I am glad to give whatever help I can. And possible learn somethings about S6 as well. Where my knowleage is lacking.

I stumbled upon this container/repo when migrating my traefik1 config to traefik2 on a new server. As I see myself having some uses for this container I am happy to put in some good work, making it better.

I will let you merge the other PRs, before I submit a PR with the logging changes.
That way I can use the merged code as a base.
I have some other ideas I might want to implement as well, but I am not a fan of adding multiple things to a PR.

So I will hold of on them until the logging change has been made. Then you can consider for each of them if you like the idea or not. If not I will just keep them in my fork.