On Tue, Jul 01, 2008 at 08:17:01PM +1000, Bluebie, Jenna wrote:
> Console.log would be nifty (and friends) for us web devs. :)
Oh, you're looking for `debug`, `error`, `info` and `warn`.
Thankyou, they've been added to the manual.
=== debug(message: a string) » nil ===
Sends a debug message to the Shoes console. You can bring
up the Shoes console by pressing `Alt-/` on any Shoes window
(or `⌘-/` on OS X.)
{{{
#!ruby
debug("Running Shoes on " + RUBY_PLATFORM)
}}}
Also check out the [[Built-in.error]], [[Built-in.warn]]
and [[Built-in.info]] methods.
=== error(message: a string) » nil ===
Sends an error message to the Shoes console. This method
should only be used to log errors. Try the [[Built-in.debug]]
method for logging messages to yourself.
Oh, and, rather than a string, you may also hand exceptions
directly to this method and they'll be formatted appropriately.
=== info(message: a string) » nil ===
Logs an informational message to the user in the Shoes console.
So, where debug messages are designed to help the program figure
out what's happening, `info` messages tell the user extra
information about the program.
{{{
#!ruby
info("You just ran the info example on Shoes #{Shoes::RELEASE_NAME}.")
}}}
For example, whenever a Shy file loads, Shoes prints an
informational message in the console describing the author of
the Shy and its version.
=== warn(message: a string) » nil ===
Logs a warning for the user. A warning is not a catastrophic error
(see [[Built-in.error error]] for that.) It is just a notice that
the program will be changing in the future or that certain parts
of the program aren't reliable yet.
To view warnings and errors, open the Shoes console with `Alt-/`
(or `⌘-/` on OS X.)
_why