Skip to content

Version > 2023.01

Debugmode

Allows us to control console.log output. If set, AppGini Helper prints out many additional information in console-tab of your browser's developer tools.

Set Debug Level

1
AppGiniHelper.setDebug(DebugLevel.Debug);

Stop Debugmode

...by setting debug level to DebugLevel.None:

1
AppGiniHelper.setDebug(DebugLevel.None);

Note
There are certain messages which can not be suppressed. Especially critical errors and certain important warnings will be logged to console anyway. Those important warnings/errors shall help you finding coding bugs, for example when addressing non-existent fields.


DebugLevels

  • None = 0
  • Debug = 1,
  • Info = 2,
  • Warning = 3,
  • Error = 4

Usage

Globally

1
2
3
4
<!-- file: hooks/header-extras.php -->
<script>
    AppGiniHelper.setDebug(DebugLevel.Debug);
</script>

In Detail View

1
2
3
// file: hooks/TABLENAME-dv.js
AppGiniHelper.setDebug(DebugLevel.Debug);
// ...

In Table View

1
2
3
// file: hooks/TABLENAME-tv.js
AppGiniHelper.setDebug(DebugLevel.Debug);
// ...

In scenario

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
try {

    // enable debugging
    AppGiniHelper.setDebug(DebugLevel.Debug);

    // call your function here
    // which may raise an error
    // simulated in next line
    throw "Custom error";

} catch (error) {
    // you can either console.log / console.error your error message...
    console.error("Error in my function call:");

    // or even make use of AppGiniHelper.error function...
    AppGiniHelper.error(error);

} finally {
    // disable debugging
    AppGiniHelper.setDebug(DebugLevel.None);
}

See also