Search code examples
moodlemoodle-mobile

Where to find console.log's output written in Javascript of mobile support in Moodle Plugin?


While developing Mobile Support for Moodle Plugins, we can use Javascript that is defined in plugin/classes/output/mobile.php.

Where can I find the console.log's output written in this Javascript file?

I am developing mobile support for Flexible section course format plugin in Moodle. I have defined Javascript file in moodle/format/flexsections/classes/output/mobile.php as:

...
...

return [
        'templates' => [
            [
                'id' => 'main',
                'html' => $html
            ]
        ],
        'javascript' => file_get_contents(__DIR__ . '/../../js/mobile/add_styling.js'),
        'otherdata' => [

        ]
    ];

And I have created a Javascript file in moodle/format/flexsections/js/add_styling.js as:

console.log("Debug_test");

Then I build a moodle app using: ionic cordova build android --debug

The custom mustache template is rendered fine but when I use adb logcat | grep "Debug_test" there is no output by the console log.

I opened chrome://inspect/#devices in Google Chrome, clicked inspect and opened the console, there is no output by the console log.

Everytime I looked at the console for output, in the mobile app I go to App settings -> Space Usage -> Delete the user data and then I close and open the app, then click on the course.


Solution

  • Moodle App Plugins Development Guide solved the issue.

    And I found the output using:

    adb logcat | grep "Debug_test"