outputString Method

Writes a string to the console.

Syntax

System.Debug.outputString(strOutputString)

Parameters

strOutputString Required. String to write to the console.

Return Value

No return value.

Remarks

Useful for sending variable values, gadget state, or function names to the console for debugging.

The value of strOutputString can only be viewed with a script debugger while the gadget is running.

Example

The following example demonstrates how to throw an error and use outputString to display it in a debugger console.

// --------------------------------------------------------------------
// Attempt to save the file and throw an error if the filename does 
// not include a file extension.
// --------------------------------------------------------------------
function SaveFile()
{
    var fso = new ActiveXObject( "Scripting.FileSystemObject" );
    // Throw an arbitrary error to demonstrate the outputString method.
    try
    {
        if (sFilename.indexOf(".") == -1)
        {            
            throw "'Filename' does not specify a file extension.";
        }
        var file = 
            fso.OpenTextFile(sFilePath + sFilename, 
            FOR_WRITING, CREATE_NEW);
        file.Write(sContent);
        file.Close();
        fso = file = null;
    }
    catch(e)
    {
        System.Debug.outputString(e);
    }
}

Applies To

System.Debug

See Also

System.Debug
Tags :


Page view tracker