Class: Toybox.Test.Logger

Inherits:
Toybox.Lang.Object show all

Overview

The Logger class provides output capabilities to tests.

It is not necessary to instantiate the Logger class. This is done automatically behind the scenes.

Since:

API Level 2.1.0

Instance Method Summary collapse

Instance Method Details

debug(str as Lang.Object) as Void

Write a debug String to the output stream.

The String is prefixed with DEBUG and a time stamp.

Parameters:

  • str(Lang.String)

    The String output to the console

Example:

using Toybox.Test;
(:test)
function aDebugTest(logger) {
   logger.debug("This is a debug message.");
   return true;
}
// Output:
DEBUG (9:23): This is a debug message.

Since:

API Level 2.1.0

error(str as Lang.Object) as Void

Write an error String to the output stream.

The String is prefixed with ERROR and time stamp.

Parameters:

  • str(Lang.String)

    The String output to the console

Example:

using Toybox.Test;
(:test)
function anErrorTest(logger) {
   logger.error("This is an error message.");
   return true;
}
// Output:
ERROR (9:24): This is an error message.

Since:

API Level 2.1.0

warning(str as Lang.Object) as Void

Write a warning String to the output stream.

The String is prefixed with WARNING and a time stamp.

Parameters:

  • str(Lang.String)

    The String output to the console

Example:

using Toybox.Test;
(:test)
function aWarningTest(logger) {
   logger.warning("This is a warning message.");
   return true;
}
// Output:
WARNING (9:23): This is a warning message.

Since:

API Level 2.1.0


Generated Dec 11, 2024, 8:58:43 AM