{"action":"created","comment":{"url":"https://api.github.com/repos/lyft/metadataproxy/pulls/comments/114652680","pull_request_review_id":36137819,"id":114652680,"diff_hunk":"@@ -0,0 +1,170 @@\n+# -*- coding: utf-8 -*-\n+\"\"\"\n+log:\n+    Encapsulates all of the log setup for seatgeek default loggers.\n+\n+    Environment Variables:\n+        LOGGING_VERBOSE: Should run logger in verbose mode, which outputs\n+            logger.debug() messages. Default = False.\n+\n+    Interface:\n+        from metadataproxy import log\n+        logger = log.get_logger(\"my.logger\")\n+        logger.info(\"Hi There)\n+        >> [2012-11-12 15:05:22] my.logger - INFO - Hi There\n+\"\"\"\n+import datetime\n+import os\n+import sys\n+import logging\n+import logging.config\n+\n+\n+# log settings for root logger by default\n+LOG_SETTINGS = {\n+    'version': 1,\n+    'disable_existing_loggers': True,\n+    'formatters': {\n+        'normal': {\n+            'format': \"[%(asctime)s +0000] %(name)s [pid:%(process)d] - %(levelname)s - %(message)s\",\n+            'datefmt': \"%Y-%m-%d %H:%M:%S\"\n+        },\n+        'werkzeug': {\n+            'format': \"[%(asctime)s +0000] %(name)s [pid:%(process)d] - %(levelname)s - %(message)s\",\n+            'datefmt': \"%Y-%m-%d %H:%M:%S\"\n+        },\n+    },\n+    'handlers': {\n+        'console': {\n+            'level': 'INFO',\n+            'class': 'logging.StreamHandler',\n+            'formatter': 'normal',\n+            'stream': 'ext://sys.stdout'\n+        },\n+        'console_werkzeug': {\n+            'level': 'INFO',\n+            'class': 'logging.StreamHandler',\n+            'formatter': 'werkzeug',\n+            'stream': 'ext://sys.stdout'\n+        },\n+        'error': {\n+            'level': 'ERROR',\n+            'class': 'logging.StreamHandler',\n+            'formatter': 'normal',\n+            'stream': 'ext://sys.stderr'\n+        },\n+    },\n+    'loggers': {\n+        'sqlalchemy.engine': {\n+            'level': os.getenv('SQLALCHEMY_ENGINE_LOGGER_LEVEL' 'INFO'),\n+            'propagate': True,\n+        },\n+        'werkzeug': {\n+            'handlers': ['console_werkzeug'],\n+            'level': 'DEBUG',\n+            'propagate': False,\n+        },\n+    },\n+    'root': {\n+        'level': 'NOTSET',\n+        'handlers': ['console', 'error']\n+    },\n+}\n+\n+normal_formatter = logging.Formatter(\n+    fmt=LOG_SETTINGS['formatters']['normal']['format'],\n+    datefmt=LOG_SETTINGS['formatters']['normal']['datefmt'])\n+\n+werkzeug_formatter = logging.Formatter(\n+    fmt=LOG_SETTINGS['formatters']['werkzeug']['format'],\n+    datefmt=LOG_SETTINGS['formatters']['werkzeug']['datefmt'])\n+\n+werkzeug_stream_handler = logging.StreamHandler(sys.stdout)\n+werkzeug_stream_handler.setFormatter(werkzeug_formatter)\n+\n+werkzeug_error_stream_handler = logging.StreamHandler(sys.stderr)\n+werkzeug_error_stream_handler.setFormatter(werkzeug_formatter)\n+werkzeug_error_stream_handler.setLevel(logging.ERROR)\n+\n+stream_handler = logging.StreamHandler(sys.stdout)\n+stream_handler.setFormatter(normal_formatter)\n+\n+error_stream_handler = logging.StreamHandler(sys.stderr)\n+error_stream_handler.setFormatter(normal_formatter)\n+error_stream_handler.setLevel(logging.ERROR)\n+\n+# environment flags we should honor\n+BUGSNAG_API_KEY = os.getenv('BUGSNAG_API_KEY', None)\n+SENTRY_DSN = os.getenv('SENTRY_DSN', None)\n+\n+logging.config.dictConfig(LOG_SETTINGS)\n+\n+if BUGSNAG_API_KEY:\n+    import bugsnag\n+\n+if SENTRY_DSN:\n+    from raven.conf import setup_logging\n+    from raven.handlers.logging import SentryHandler\n+    assert setup_logging","path":"metadataproxy/log.py","position":108,"original_position":108,"commit_id":"c9334c8b6190d6eec73db218b9f22ad38e7123f3","original_commit_id":"c9334c8b6190d6eec73db218b9f22ad38e7123f3","user":{"login":"ryan-lane","id":1538354,"avatar_url":"https://avatars2.githubusercontent.com/u/1538354?v=3","gravatar_id":"","url":"https://api.github.com/users/ryan-lane","html_url":"https://github.com/ryan-lane","followers_url":"https://api.github.com/users/ryan-lane/followers","following_url":"https://api.github.com/users/ryan-lane/following{/other_user}","gists_url":"https://api.github.com/users/ryan-lane/gists{/gist_id}","starred_url":"https://api.github.com/users/ryan-lane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryan-lane/subscriptions","organizations_url":"https://api.github.com/users/ryan-lane/orgs","repos_url":"https://api.github.com/users/ryan-lane/repos","events_url":"https://api.github.com/users/ryan-lane/events{/privacy}","received_events_url":"https://api.github.com/users/ryan-lane/received_events","type":"User","site_admin":false},"body":"https://wiki.python.org/moin/UsingAssertionsEffectively\r\n\r\nSee the last two paragraphs.","created_at":"2017-05-03T21:01:56Z","updated_at":"2017-05-03T21:01:56Z","html_url":"https://github.com/lyft/metadataproxy/pull/57#discussion_r114652680","pull_request_url":"https://api.github.com/repos/lyft/metadataproxy/pulls/57","_links":{"self":{"href":"https://api.github.com/repos/lyft/metadataproxy/pulls/comments/114652680"},"html":{"href":"https://github.com/lyft/metadataproxy/pull/57#discussion_r114652680"},"pull_request":{"href":"https://api.github.com/repos/lyft/metadataproxy/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/lyft/metadataproxy/pulls/57","id":118608810,"html_url":"https://github.com/lyft/metadataproxy/pull/57","diff_url":"https://github.com/lyft/metadataproxy/pull/57.diff","patch_url":"https://github.com/lyft/metadataproxy/pull/57.patch","issue_url":"https://api.github.com/repos/lyft/metadataproxy/issues/57","number":57,"state":"open","locked":false,"title":"Refactor for better logging","user":{"login":"josegonzalez","id":65675,"avatar_url":"https://avatars1.githubusercontent.com/u/65675?v=3","gravatar_id":"","url":"https://api.github.com/users/josegonzalez","html_url":"https://github.com/josegonzalez","followers_url":"https://api.github.com/users/josegonzalez/followers","following_url":"https://api.github.com/users/josegonzalez/following{/other_user}","gists_url":"https://api.github.com/users/josegonzalez/gists{/gist_id}","starred_url":"https://api.github.com/users/josegonzalez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josegonzalez/subscriptions","organizations_url":"https://api.github.com/users/josegonzalez/orgs","repos_url":"https://api.github.com/users/josegonzalez/repos","events_url":"https://api.github.com/users/josegonzalez/events{/privacy}","received_events_url":"https://api.github.com/users/josegonzalez/received_events","type":"User","site_admin":false},"body":"- use blueprints instead of flask app\r\n- made dockerfile builds faster by installing requirements *before* adding the entire source tree\r\n- standardize on a single logging format (which may not be BC if you are expecting it one way in your log aggregation tooling)\r\n- added support for bugsnag/sentry\r\n\r\nLet me know if you want me to remove anything.","created_at":"2017-05-02T17:46:44Z","updated_at":"2017-05-03T21:01:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5f78cf167654f120fe4561bac393f4a083d59c0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/lyft/metadataproxy/pulls/57/commits","review_comments_url":"https://api.github.com/repos/lyft/metadataproxy/pulls/57/comments","review_comment_url":"https://api.github.com/repos/lyft/metadataproxy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lyft/metadataproxy/issues/57/comments","statuses_url":"https://api.github.com/repos/lyft/metadataproxy/statuses/c9334c8b6190d6eec73db218b9f22ad38e7123f3","head":{"label":"josegonzalez:master","ref":"master","sha":"c9334c8b6190d6eec73db218b9f22ad38e7123f3","user":{"login":"josegonzalez","id":65675,"avatar_url":"https://avatars1.githubusercontent.com/u/65675?v=3","gravatar_id":"","url":"https://api.github.com/users/josegonzalez","html_url":"https://github.com/josegonzalez","followers_url":"https://api.github.com/users/josegonzalez/followers","following_url":"https://api.github.com/users/josegonzalez/following{/other_user}","gists_url":"https://api.github.com/users/josegonzalez/gists{/gist_id}","starred_url":"https://api.github.com/users/josegonzalez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josegonzalez/subscriptions","organizations_url":"https://api.github.com/users/josegonzalez/orgs","repos_url":"https://api.github.com/users/josegonzalez/repos","events_url":"https://api.github.com/users/josegonzalez/events{/privacy}","received_events_url":"https://api.github.com/users/josegonzalez/received_events","type":"User","site_admin":false},"repo":{"id":83757954,"name":"metadataproxy","full_name":"josegonzalez/metadataproxy","owner":{"login":"josegonzalez","id":65675,"avatar_url":"https://avatars1.githubusercontent.com/u/65675?v=3","gravatar_id":"","url":"https://api.github.com/users/josegonzalez","html_url":"https://github.com/josegonzalez","followers_url":"https://api.github.com/users/josegonzalez/followers","following_url":"https://api.github.com/users/josegonzalez/following{/other_user}","gists_url":"https://api.github.com/users/josegonzalez/gists{/gist_id}","starred_url":"https://api.github.com/users/josegonzalez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josegonzalez/subscriptions","organizations_url":"https://api.github.com/users/josegonzalez/orgs","repos_url":"https://api.github.com/users/josegonzalez/repos","events_url":"https://api.github.com/users/josegonzalez/events{/privacy}","received_events_url":"https://api.github.com/users/josegonzalez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/josegonzalez/metadataproxy","description":"A proxy for AWS's metadata service that gives out scoped IAM credentials from STS","fork":true,"url":"https://api.github.com/repos/josegonzalez/metadataproxy","forks_url":"https://api.github.com/repos/josegonzalez/metadataproxy/forks","keys_url":"https://api.github.com/repos/josegonzalez/metadataproxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/josegonzalez/metadataproxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/josegonzalez/metadataproxy/teams","hooks_url":"https://api.github.com/repos/josegonzalez/metadataproxy/hooks","issue_events_url":"https://api.github.com/repos/josegonzalez/metadataproxy/issues/events{/number}","events_url":"https://api.github.com/repos/josegonzalez/metadataproxy/events","assignees_url":"https://api.github.com/repos/josegonzalez/metadataproxy/assignees{/user}","branches_url":"https://api.github.com/repos/josegonzalez/metadataproxy/branches{/branch}","tags_url":"https://api.github.com/repos/josegonzalez/metadataproxy/tags","blobs_url":"https://api.github.com/repos/josegonzalez/metadataproxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/josegonzalez/metadataproxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/josegonzalez/metadataproxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/josegonzalez/metadataproxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/josegonzalez/metadataproxy/statuses/{sha}","languages_url":"https://api.github.com/repos/josegonzalez/metadataproxy/languages","stargazers_url":"https://api.github.com/repos/josegonzalez/metadataproxy/stargazers","contributors_url":"https://api.github.com/repos/josegonzalez/metadataproxy/contributors","subscribers_url":"https://api.github.com/repos/josegonzalez/metadataproxy/subscribers","subscription_url":"https://api.github.com/repos/josegonzalez/metadataproxy/subscription","commits_url":"https://api.github.com/repos/josegonzalez/metadataproxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/josegonzalez/metadataproxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/josegonzalez/metadataproxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/josegonzalez/metadataproxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/josegonzalez/metadataproxy/contents/{+path}","compare_url":"https://api.github.com/repos/josegonzalez/metadataproxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/josegonzalez/metadataproxy/merges","archive_url":"https://api.github.com/repos/josegonzalez/metadataproxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/josegonzalez/metadataproxy/downloads","issues_url":"https://api.github.com/repos/josegonzalez/metadataproxy/issues{/number}","pulls_url":"https://api.github.com/repos/josegonzalez/metadataproxy/pulls{/number}","milestones_url":"https://api.github.com/repos/josegonzalez/metadataproxy/milestones{/number}","notifications_url":"https://api.github.com/repos/josegonzalez/metadataproxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/josegonzalez/metadataproxy/labels{/name}","releases_url":"https://api.github.com/repos/josegonzalez/metadataproxy/releases{/id}","deployments_url":"https://api.github.com/repos/josegonzalez/metadataproxy/deployments","created_at":"2017-03-03T04:38:49Z","updated_at":"2017-03-03T04:38:52Z","pushed_at":"2017-05-02T18:00:14Z","git_url":"git://github.com/josegonzalez/metadataproxy.git","ssh_url":"git@github.com:josegonzalez/metadataproxy.git","clone_url":"https://github.com/josegonzalez/metadataproxy.git","svn_url":"https://github.com/josegonzalez/metadataproxy","homepage":"","size":75,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lyft:master","ref":"master","sha":"53691f49ad968aab381e3fe4d40656ca35f650bb","user":{"login":"lyft","id":4269340,"avatar_url":"https://avatars1.githubusercontent.com/u/4269340?v=3","gravatar_id":"","url":"https://api.github.com/users/lyft","html_url":"https://github.com/lyft","followers_url":"https://api.github.com/users/lyft/followers","following_url":"https://api.github.com/users/lyft/following{/other_user}","gists_url":"https://api.github.com/users/lyft/gists{/gist_id}","starred_url":"https://api.github.com/users/lyft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyft/subscriptions","organizations_url":"https://api.github.com/users/lyft/orgs","repos_url":"https://api.github.com/users/lyft/repos","events_url":"https://api.github.com/users/lyft/events{/privacy}","received_events_url":"https://api.github.com/users/lyft/received_events","type":"Organization","site_admin":false},"repo":{"id":52999353,"name":"metadataproxy","full_name":"lyft/metadataproxy","owner":{"login":"lyft","id":4269340,"avatar_url":"https://avatars1.githubusercontent.com/u/4269340?v=3","gravatar_id":"","url":"https://api.github.com/users/lyft","html_url":"https://github.com/lyft","followers_url":"https://api.github.com/users/lyft/followers","following_url":"https://api.github.com/users/lyft/following{/other_user}","gists_url":"https://api.github.com/users/lyft/gists{/gist_id}","starred_url":"https://api.github.com/users/lyft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyft/subscriptions","organizations_url":"https://api.github.com/users/lyft/orgs","repos_url":"https://api.github.com/users/lyft/repos","events_url":"https://api.github.com/users/lyft/events{/privacy}","received_events_url":"https://api.github.com/users/lyft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lyft/metadataproxy","description":"A proxy for AWS's metadata service that gives out scoped IAM credentials from STS","fork":false,"url":"https://api.github.com/repos/lyft/metadataproxy","forks_url":"https://api.github.com/repos/lyft/metadataproxy/forks","keys_url":"https://api.github.com/repos/lyft/metadataproxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lyft/metadataproxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lyft/metadataproxy/teams","hooks_url":"https://api.github.com/repos/lyft/metadataproxy/hooks","issue_events_url":"https://api.github.com/repos/lyft/metadataproxy/issues/events{/number}","events_url":"https://api.github.com/repos/lyft/metadataproxy/events","assignees_url":"https://api.github.com/repos/lyft/metadataproxy/assignees{/user}","branches_url":"https://api.github.com/repos/lyft/metadataproxy/branches{/branch}","tags_url":"https://api.github.com/repos/lyft/metadataproxy/tags","blobs_url":"https://api.github.com/repos/lyft/metadataproxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lyft/metadataproxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lyft/metadataproxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/lyft/metadataproxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lyft/metadataproxy/statuses/{sha}","languages_url":"https://api.github.com/repos/lyft/metadataproxy/languages","stargazers_url":"https://api.github.com/repos/lyft/metadataproxy/stargazers","contributors_url":"https://api.github.com/repos/lyft/metadataproxy/contributors","subscribers_url":"https://api.github.com/repos/lyft/metadataproxy/subscribers","subscription_url":"https://api.github.com/repos/lyft/metadataproxy/subscription","commits_url":"https://api.github.com/repos/lyft/metadataproxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/lyft/metadataproxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/lyft/metadataproxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/lyft/metadataproxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/lyft/metadataproxy/contents/{+path}","compare_url":"https://api.github.com/repos/lyft/metadataproxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lyft/metadataproxy/merges","archive_url":"https://api.github.com/repos/lyft/metadataproxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lyft/metadataproxy/downloads","issues_url":"https://api.github.com/repos/lyft/metadataproxy/issues{/number}","pulls_url":"https://api.github.com/repos/lyft/metadataproxy/pulls{/number}","milestones_url":"https://api.github.com/repos/lyft/metadataproxy/milestones{/number}","notifications_url":"https://api.github.com/repos/lyft/metadataproxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lyft/metadataproxy/labels{/name}","releases_url":"https://api.github.com/repos/lyft/metadataproxy/releases{/id}","deployments_url":"https://api.github.com/repos/lyft/metadataproxy/deployments","created_at":"2016-03-02T21:56:23Z","updated_at":"2017-05-03T11:50:10Z","pushed_at":"2017-05-02T18:00:16Z","git_url":"git://github.com/lyft/metadataproxy.git","ssh_url":"git@github.com:lyft/metadataproxy.git","clone_url":"https://github.com/lyft/metadataproxy.git","svn_url":"https://github.com/lyft/metadataproxy","homepage":"","size":69,"stargazers_count":142,"watchers_count":142,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":11,"forks":24,"open_issues":11,"watchers":142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lyft/metadataproxy/pulls/57"},"html":{"href":"https://github.com/lyft/metadataproxy/pull/57"},"issue":{"href":"https://api.github.com/repos/lyft/metadataproxy/issues/57"},"comments":{"href":"https://api.github.com/repos/lyft/metadataproxy/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/lyft/metadataproxy/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/lyft/metadataproxy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lyft/metadataproxy/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/lyft/metadataproxy/statuses/c9334c8b6190d6eec73db218b9f22ad38e7123f3"}}}}
{"actor":{"display_login":"ryan-lane"}}