Skip to content

Instantly share code, notes, and snippets.

@dchowitz
Last active February 7, 2019 10:36
Show Gist options
  • Save dchowitz/745b93c408c071dcad0f486594b11fbe to your computer and use it in GitHub Desktop.
Save dchowitz/745b93c408c071dcad0f486594b11fbe to your computer and use it in GitHub Desktop.

Revisions

  1. dchowitz revised this gist Feb 7, 2019. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -15,8 +15,7 @@ enableDebug("*"); // this enables all debug output, look in the debug documentat
    After that you will see your debug output and that of your dependencies by running
    ```bash
    react-native log-android
    ```
    resp.
    ```bash
    # resp.
    react-native log-ios
    ```
    in a terminal.
  2. dchowitz revised this gist Feb 7, 2019. 1 changed file with 16 additions and 1 deletion.
    17 changes: 16 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,22 @@
    Lots of dependencies use the [debug](https://github.com/visionmedia/debug) for debug output. When debugging a React Native app with Chrome Developer tools, you can enable the debug output with
    Lots of dependencies rely on the [debug](https://github.com/visionmedia/debug) module for debug output. When debugging a React Native app with Chrome Developer tools, you can enable the debug output with
    ```js
    window.localStorage.debug = 'namespace'
    ```
    in the console.

    However, sometimes you need the debug output without running your app in Chrome's V8 context due to some subtle differences between the Javascript execution engines.

    In order to achieve this, you can simply add `enableDebug.js` to your project and import it in your `index.js` like this:
    ```js
    import enableDebug from "./enableDebug";
    enableDebug("*"); // this enables all debug output, look in the debug documentation for configuration options
    ```

    After that you will see your debug output and that of your dependencies by running
    ```bash
    react-native log-android
    ```
    resp.
    ```bash
    react-native log-ios
    ```
  3. dchowitz revised this gist Feb 7, 2019. 2 changed files with 9 additions and 1 deletion.
    8 changes: 8 additions & 0 deletions enableDebug.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    export default function(namespaces) {
    if (!window.localStorage) {
    window.localStorage = {
    removeItem: function() {}
    };
    }
    window.localStorage.debug = namespaces;
    }
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ window.localStorage.debug = 'namespace'
    ```
    in the console.

    However, sometimes you need the debug output without running your app in Chrome's V8 context due to some subtle differences
    However, sometimes you need the debug output without running your app in Chrome's V8 context due to some subtle differences between the Javascript execution engines.
  4. dchowitz created this gist Feb 7, 2019.
    7 changes: 7 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Lots of dependencies use the [debug](https://github.com/visionmedia/debug) for debug output. When debugging a React Native app with Chrome Developer tools, you can enable the debug output with
    ```js
    window.localStorage.debug = 'namespace'
    ```
    in the console.

    However, sometimes you need the debug output without running your app in Chrome's V8 context due to some subtle differences