From commits-return-2655-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Wed May 8 20:05:17 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 61D12180630 for ; Wed, 8 May 2019 22:05:17 +0200 (CEST) Received: (qmail 66784 invoked by uid 500); 8 May 2019 20:05:16 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 66762 invoked by uid 99); 8 May 2019 20:05:16 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 May 2019 20:05:16 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id C4B39872B9; Wed, 8 May 2019 20:05:15 +0000 (UTC) Date: Wed, 08 May 2019 20:05:15 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: Refactor ConsoleLog (#7428) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155734591525.1740.6897406276076224765@gitbox.apache.org> From: beto@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ca48f32a074f6411aeff8a5d220d42d75ca83204 X-Git-Newrev: ef13500d1ae7052b22c920fb1ab0c4bcb826a101 X-Git-Rev: ef13500d1ae7052b22c920fb1ab0c4bcb826a101 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. beto pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git The following commit(s) were added to refs/heads/master by this push: new ef13500 Refactor ConsoleLog (#7428) ef13500 is described below commit ef13500d1ae7052b22c920fb1ab0c4bcb826a101 Author: Beto Dealmeida AuthorDate: Wed May 8 13:05:01 2019 -0700 Refactor ConsoleLog (#7428) --- CONTRIBUTING.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4fc9057..e620e6a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -326,6 +326,31 @@ cd superset FLASK_ENV=development flask run -p 8088 --with-threads --reload --debugger ``` +#### Logging to the browser console + +This feature is only available on Python 3. When debugging your application, you can have the server logs sent directly to the browser console using the [ConsoleLog](https://github.com/betodealmeida/consolelog) package. You need to mutate the app, by adding the following to your `config.py` or `superset_config.py`: + +```python +from console_log import ConsoleLog + +def FLASK_APP_MUTATOR(app): + app.wsgi_app = ConsoleLog(app.wsgi_app, app.logger) +``` + +Then make sure you run your WSGI server using the right worker type: + +```bash +FLASK_ENV=development gunicorn superset:app -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -b 127.0.0.1:8088 --reload +``` + +You can log anything to the browser console, including objects: + +```python +from superset import app +app.logger.error('An exception occurred!') +app.logger.info(form_data) +``` + ### Frontend Assets Frontend assets (JavaScript, CSS, and images) must be compiled in order to properly display the web UI. The `superset/assets` directory contains all NPM-managed front end assets. Note that there are additional frontend assets bundled with Flask-Appbuilder (e.g. jQuery and bootstrap); these are not managed by NPM, and may be phased out in the future.