Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Logging</strong></p> <p>Vala has some fairly robust logging facilities built in. You can use <code>debug()</code>, <code>message()</code>, <code>warning()</code>, <code>error()</code>, and <code>critical()</code> as shortcuts for the slightly more complex <a href="http://valadoc.org/#!api=glib-2.0/GLib.log" rel="noreferrer"><code>log()</code></a> function. All are included in the base (automatically included) <a href="http://valadoc.org/#!wiki=glib-2.0/index" rel="noreferrer"><code>GLib</code> namespace</a>.</p> <p>If you want to redirect log output or send different types of messages to different destinations, everything you need is in the <a href="http://valadoc.org/#!api=glib-2.0/GLib.Log" rel="noreferrer"><code>GLib.Log</code> namespace</a>. You might want to read the <a href="http://developer.gnome.org/glib/stable/glib-Message-Logging.html" rel="noreferrer">glib docs on logging</a> for what's going on behind the scenes there.</p> <p><strong>Defensive Programming</strong></p> <p>Vala also includes support for assertions and contracts. The short version: <code>assert()</code> and <code>assert_not_reached()</code> for assertions, and <code>requires()</code> and <code>ensures()</code> in method signatures for contracts. See the tutorial section on <a href="http://live.gnome.org/Vala/Tutorial#Assertions_and_Contract_Programming" rel="noreferrer">Assertions and Contract Programming</a> for more info.</p> <p><strong>Error Handling</strong></p> <p>Vala's error handling is a little odd: similar-looking to exceptions, but not quite the same. The tutorial section on <a href="http://live.gnome.org/Vala/Tutorial#Error_Handling" rel="noreferrer">Error Handling</a> covers the basics pretty well, and again it might be helpful to read the <a href="http://developer.gnome.org/glib/stable/glib-Error-Reporting.html" rel="noreferrer">glib docs on errors</a> to get a more advanced understanding of what's going on behind the scenes. As far as I know, there is no way to get a stack trace out of Vala errors -- just a type and a message.</p> <p><strong>Best Practices</strong></p> <p>In terms of best practices, I think Vala is similar enough to Java or C# that the practices you already know can be applied in a general sense. I suggest playing around with these features to get a feel for how the specifics look in Vala. Good luck!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload