Fix to logging format + Link to discussion + github logging message format
authorNicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
Tue, 06 Jan 2015 17:43:23 +0100
changeset 31 511f3b94c616
parent 25 e839084fb54a
child 32 74040696c850
Fix to logging format + Link to discussion + github logging message format
src/catedit/__init__.py
src/catedit/persistence.py
src/catedit/templates/catrecap.html
--- a/src/catedit/__init__.py	Tue Jan 06 15:53:09 2015 +0100
+++ b/src/catedit/__init__.py	Tue Jan 06 17:43:23 2015 +0100
@@ -46,17 +46,11 @@
 # set up logging
 if app.config["LOGGING"]:
     file_handler = FileHandler(filename=app.config["LOG_FILE_PATH"])
-    file_handler.setFormatter(Formatter('''
-    Message type:       %(levelname)s
-    Location:           %(pathname)s:%(lineno)d
-    Module:             %(module)s
-    Function:           %(funcName)s
-    Time:               %(asctime)s
-
-    Message:
-
-    %(message)s
-    '''))
+    file_handler.setFormatter(Formatter(
+        '%(asctime)s %(levelname)s: %(message)s '
+        '[in %(pathname)s:%(lineno)d]',
+        '%Y-%m-%d %H:%M:%S'
+    ))
     app.logger.addHandler(file_handler)
     app.logger.setLevel(app.config["LOGGING_LEVEL"])
 
--- a/src/catedit/persistence.py	Tue Jan 06 15:53:09 2015 +0100
+++ b/src/catedit/persistence.py	Tue Jan 06 17:43:23 2015 +0100
@@ -195,8 +195,8 @@
             )
             logger.debug(str(ref_master))
         except GitHubError as ghe:
-            logger.debug("GitHubError trying to get the reference \
-                         to the master branch")
+            logger.debug("GitHubError trying to get the reference "
+                         + "to the master branch")
             logger.debug(
                 "Endpoint: "
                 + "repos/"
@@ -218,8 +218,8 @@
             )
             logger.debug(str(last_commit_master))
         except GitHubError as ghe:
-            logger.debug("GitHubError trying to get the commit associated \
-                         to the latest reference to the master branch")
+            logger.debug("GitHubError trying to get the commit associated "
+                         + "to the latest reference to the master branch")
             logger.debug(ghe.response.text)
         logger.debug(str(github.get("rate_limit")["resources"]))
 
@@ -235,9 +235,9 @@
             )
             logger.debug(str(last_commit_tree))
         except GitHubError as ghe:
-            logger.debug("GitHubError trying to get the tree from the commit \
-                         associated to the latest reference to the master \
-                         branch")
+            logger.debug("GitHubError trying to get the tree from the commit "
+                         + "associated to the latest reference to the master "
+                         + "branch")
             logger.debug(ghe.response.text)
         logger.debug(str(github.get("rate_limit")["resources"]))
 
@@ -292,8 +292,8 @@
                                     break
                                 except GitHubError as ghe:
                                     logger.debug(
-                                        "GitHubError trying to post a new \
-                                        blob with following data: "
+                                        "GitHubError trying to post a new"
+                                        + "blob with following data: "
                                         + str(new_blob_data)
                                     )
                                     logger.debug(ghe.response.text)
@@ -333,8 +333,8 @@
                     )
                 except GitHubError as ghe:
                     logger.debug(
-                        "GitHubError trying to post a new blob with following \
-                        data: "
+                        "GitHubError trying to post a new blob with following"
+                        + "data: "
                         + str(new_blob_data)
                     )
                     logger.debug(ghe.response.text)
@@ -399,8 +399,8 @@
             logger.debug(str(new_head))
         except GitHubError as ghe:
             logger.debug(
-                "GitHubError trying to edit the head to the master branch \
-                with the following data: "
+                "GitHubError trying to edit the head to the master branch"
+                + "with the following data: "
                 + str(new_head_data)
             )
             logger.debug(ghe.response.text)
@@ -421,8 +421,8 @@
             file_content = str(b64decode(filedict["content"]), "utf-8")
         except GitHubError as ghe:
             logger.debug("Github Error trying to get file: "+kwargs["name"])
-            logger.debug("Github sent an error, if 404, either you may not \
-                         have access to the repository or it doesn't exist ")
+            logger.debug("Github sent an error, if 404, either you may not "
+                         + "have access to the repository or it doesn't exist ")
             logger.debug(ghe.response.text)
         logger.debug(str(github.get("rate_limit")["resources"]))
         return file_content
@@ -453,11 +453,11 @@
                               for github_file in files_in_repo]
             # logger.debug(filenames_list)
         except GitHubError as ghe:
-            logger.debug("Github Error trying to get the file list in the \
-                         category repository")
-            logger.debug("NOTE: Github sent an error, if 404 either you \
-                         may not have access to the repository or it doesn't \
-                         exist or there isn't any files in it")
+            logger.debug("Github Error trying to get the file list in the "
+                         + "category repository")
+            logger.debug("NOTE: Github sent an error, if 404 either you "
+                         + "may not have access to the repository or it "
+                         + "doesn't exist or there isn't any files in it")
             logger.debug(ghe.response.text)
         logger.debug(str(github.get("rate_limit")["resources"]))
 
--- a/src/catedit/templates/catrecap.html	Tue Jan 06 15:53:09 2015 +0100
+++ b/src/catedit/templates/catrecap.html	Tue Jan 06 17:43:23 2015 +0100
@@ -168,5 +168,5 @@
   <h4> Soumettre mes changements actuels : <a href="{{ url_for('cat_modifs', repository=current_repository)}}" title="Soumettre changements" class="btn btn-default" {% if readonly %}disabled{% endif %}><span class="glyphicon glyphicon-share"/></a>
   </h4>
   {% endif %}
-  <h3> Consulter l'historique des modifications : <a href="https://github.com/{{config['REPOSITORY_OWNER']}}/{{config['REPOSITORY_NAME']}}/commits/master" title="Aller à l'historique des modifications sur Github" class="btn btn-default"><span class="glyphicon glyphicon-list"/></a></h3>
+  <h3> Consulter l'historique des modifications : <a href="https://github.com/{{config['REPOSITORY_OWNER']}}/{{current_repository}}/commits/master" title="Aller à l'historique des modifications sur Github" class="btn btn-default"><span class="glyphicon glyphicon-list"/></a></h3>
 {% endblock page_content %}