Browse Source

Use proper logging routines

master
Chris Smith 6 years ago
parent
commit
06666581ce
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      main.py

+ 5
- 5
main.py View File

@@ -86,23 +86,23 @@ def handle_index():
86 86
     return app.send_static_file("index.html")
87 87
 
88 88
 
89
-@app.route("/hooks/gitea/<path:repo>/<hash>", methods=['POST'])
89
+@app.route("/hooks/gitea/<path:repo>/<hash>", methods=["POST"])
90 90
 def handle_hook_gitea(repo, hash):
91
-    print(f"Received hook for repo {repo} with has {hash}")
91
+    app.logger.info(f"Received hook for repo {repo} with has {hash}")
92 92
     expected_hash = get_hook_key("gitea", repo)
93 93
     if hash != expected_hash:
94
-        print(f"Hash mismatch: expected {expected_hash}")
94
+        app.logger.info(f"Hash mismatch: expected {expected_hash}")
95 95
         abort(403)
96 96
 
97 97
     if repo not in repos:
98
-        print(f"Repository not found. Known repos: {repos.keys()}")
98
+        app.logger.info(f"Repository not found. Known repos: {repos.keys()}")
99 99
         abort(404)
100 100
 
101 101
     urls = repos[repo]
102 102
     for name, spec, url in jobs:
103 103
         if url in urls:
104 104
             # TODO: Check branches
105
-            print(f"Found matching job: {name} with URL {url}")
105
+            app.logger.info(f"Found matching job: {name} with URL {url}")
106 106
             jenkins_server.build_job(name)
107 107
 
108 108
     return "", 204

Loading…
Cancel
Save