Tag: debug

Flutter: How to remove the debug banner during development

By default, Flutter shows a debug banner on the top right corner of an app, that indicates that the app was build in debug mode.

This banner…

… is intended to deter people from complaining that your app is slow when it’s in debug mode. In debug mode, Flutter enables a large number of expensive diagnostics to aid in development, and so performance in debug mode is not representative of what will happen in release mode.

https://api.flutter.dev/flutter/material/MaterialApp/debugShowCheckedModeBanner.html

But sometimes you want to remove this banner because it overlaps UI elements or other view elements. To do so, you can simply remove the debug banner by setting the debugShowCheckedModeBanner property of the MaterialApp widget to false. For example:

MaterialApp(
  debugShowCheckedModeBanner: false,
  // ...
)

This will remove the banner at the top right corner that indicates the app is in debug mode.

This banner is only visible in debug mode. When you compile your app in release mode, this banner is not visible at all.

 

Enable debugging output in PHPUnit

When running PHPunit there are only dots and letters for each test by default:

To enable debug output and get some more details about the tests running, simply add the logging section to phpunit.xml.dist:

    <logging>
        <log type="testdox-text" target="php://stdout"/>
    </logging>

This will create a debug output and helps to track the tests:

In my case, this helped when my code reached an infinite loop due to an error. This results in a RuntimeException without any outputs or log messages. The process just ended with:

[Symfony\Component\Process\Exception\RuntimeException]  
The process has been signaled with signal "11". 

 

CakePHP 2: versenden von Emails (CakeEmail) debuggen

Möglichkeit 1: Debug-Einstellung setzen

Eine einfache Möglichkeit, um das Versenden von Emails in CakePHP 2.x zu testen, ist die Debug-Einstellung der Email Konfiguration. Dabei genügt das Setzen der Transport-Einstellung auf ‘Debug’ und schon wird der Inhalt der Email an der entsprechenden Stelle angezeigt:

<?php
// app/Config/email.php
class EmailConfig {
   public $default = array(
      'transport' => 'Debug',
      // ...

Dies funktioniert allerdings nur, wenn man sich die Ausgabe des aufgerufenen Scripts anzeigen lassen kann. Bei Cronjobs beispielsweise wird dies schon schwieriger.

CakePHP 1: das Versenden von Emails prüfen

Über die Email-Komponente von CakePHP lassen sich ziemlich komfortabel Emails versenden. Ob diese Emails dann auch ankommen kann man (im Entwicklerstatus) beispielsweise durch die Angabe der eigenen Email-Adresse als Empfänger realisieren, was allerdings nicht gerade vorteilhaft und manchmal auch etwas zeitintensiv ist. Angenehmer ist hier die eingebaute Debug-Möglichkeit der Email-Komponente.