Monitor

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
(Added parameter description and examples)
m (Added categories)
 
Line 42: Line 42:
* [[unmonitor]]
* [[unmonitor]]
* [[Command Line API]]
* [[Command Line API]]
 +
 +
[[Category:Firebug]]
 +
[[Category:UI]]
 +
[[Category:API]]

Latest revision as of 00:05, 22 November 2013

Turns on logging for all calls to a function.

This means whenever that function is called, a log message will be created inside the Console Panel showing the function name, the parameters and their values.

Contents

[edit] Syntax

monitor(fn)

[edit] Parameters

[edit] fn

Function to log calls for. (required)

[edit] Examples

Having the following function:

  1. function faculty(n)
  2. {
  3.     if (n==1 || n==0)
  4.         return 1;
  5.  
  6.     var facNumber = 1;
  7.     for (i = 1; i <= n; i++)
  8.         facNumber *= i;
  9.  
  10.     return facNumber;
  11. }
monitor(faculty)

This enables logging of calls to the function faculty(). So calling this function like faculty(5), a log message like the following will be created:

faculty(n=5)

[edit] See also

Personal tools