Console.log: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
Line 9: Line 9:
{| class="wikitable"
{| class="wikitable"
|-
|-
|console.assert(expression, object) || If the specified expression is false, the message is written to the console along with a stack trace
|console.assert(expression, object) ||  
|-
|-
|console.clear() || Clears the console.
|console.clear() ||  
|-
|-
|console.count(label) || Writes the the number of times that count() has been invoked at the same line and with the same label.
|console.count(label) ||  
|-
|-
|console.debug(object [, object, ...]) || Same as console.log.
|console.debug(object [, object, ...]) ||  
|-
|-
|console.dir(object) || Prints a JavaScript representation of the specified object.
|console.dir(object) ||  
|-
|-
|console.dirxml(object) || Prints an XML representation of the specified object.
|console.dirxml(object) ||  
|-
|-
|console.error(object [, object, ...]) || Similar to console.log, but includes a trace().
|console.error(object [, object, ...]) ||  
|-
|-
|console.group(object[, object, ...]) || Starts a new logging group with an optional title
|console.group(object[, object, ...]) ||  
|-
|-
|console.groupCollapsed(object[, object, ...]) || Creates a new logging group that is initially collapsed
|console.groupCollapsed(object[, object, ...]) ||  
|-
|-
|console.groupEnd() || Closes the most recently created logging group.
|console.groupEnd() ||  
|-
|-
|console.info(object [, object, ...]) || Same as console.log.
|console.info(object [, object, ...]) ||  
|-
|-
|console.log(object [, object, ...]) || Output a string or variable to the log.
|console.log(object [, object, ...]) ||  
|-
|-
|console.profile([label]) || Starts a JavaScript CPU profile with an optional label.
|console.profile([label]) ||  
|-
|-
|console.profileEnd() || Stops the current JavaScript CPU profiling session and outputs to Profile panel.
|console.profileEnd() ||  
|-
|-
|console.time(label) || Starts a new timer with an associated label.
|console.time(label) ||  
|-
|-
|console.timeEnd(label) || Stops the timer with the specified label and prints the elapsed time.
|console.timeEnd(label) ||  
|-
|-
|console.timeStamp([label]) || Puts an entry in the Debugger Timeline.
|console.timeStamp([label]) ||  
|-
|-
|console.trace() || Shows a stack trace. See what function you are coming from.
|console.trace() ||  
|-
|-
|console.warn(object [, object, ...]) || Similar to console.log, but with a warning label.
|console.warn(object [, object, ...]) ||  
|}
|}


Line 53: Line 53:
Rem console.log
Rem console.log


console.log("This is a logging message")
ChangeForm(Form2)           
'go to next form without transition
 
Function Form1_onhide()
  MsgBox "Old Form Hidden"
End Function
 
Function Form2_onshow()
  Msgbox "Show form " & NSBCurrentForm.id
End Function
</pre>
</pre>


== Example (JavaScript) ==
== Example (JavaScript) ==
<pre>
<pre>
//console.log sample call
//ChangeForm sample call
 
ChangeForm(Form2);
//go to next form without transition


console.log("This is a logging message");
Form1.onhide = function() {
  alert("Old Form Hidden");
}
 
Form2.onshow = function() {
  alert("Show form " +  NSBCurrentForm.id);
}
</pre>
</pre>


== Output ==
== Output ==


(on console in Debugger)
(msgbox showing "Old Form Hidden")
<pre>
 
This is a logging message
(msgbox showing "Show form Form2")
</pre>


== Related Items ==
== Related Items ==
Line 76: Line 93:
[[Category:Language Reference]]
[[Category:Language Reference]]


[[Category:Statements - Debugging]]
[[Category:Statements - Flow of control]]

Revision as of 11:20, 8 October 2013

console.log(message)

Description

Console.log outputs text to the debugger's console. If you run your app with the debugger's console window open, you can see the message as your program runs. This is useful for tracing program execution, checking variable's value during execution and for timing.

Here are related console commands:

console.assert(expression, object)
console.clear()
console.count(label)
console.debug(object [, object, ...])
console.dir(object)
console.dirxml(object)
console.error(object [, object, ...])
console.group(object[, object, ...])
console.groupCollapsed(object[, object, ...])
console.groupEnd()
console.info(object [, object, ...])
console.log(object [, object, ...])
console.profile([label])
console.profileEnd()
console.time(label)
console.timeEnd(label)
console.timeStamp([label])
console.trace()
console.warn(object [, object, ...])

Example (Basic)

Rem console.log

ChangeForm(Form2)             
'go to next form without transition

Function Form1_onhide()
  MsgBox "Old Form Hidden"
End Function

Function Form2_onshow()
  Msgbox "Show form " & NSBCurrentForm.id
End Function

Example (JavaScript)

//ChangeForm sample call

ChangeForm(Form2);
//go to next form without transition

Form1.onhide = function() {
  alert("Old Form Hidden");
}

Form2.onshow = function() {
  alert("Show form " +  NSBCurrentForm.id);
}

Output

(msgbox showing "Old Form Hidden")

(msgbox showing "Show form Form2")

Related Items

Form