selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
119 lines • 20.9 kB
HTML
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"><meta http-equiv="Content-Language" content="en"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Logger</title><link href="dossier.css" rel="stylesheet" type="text/css"><header><div><form><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></header><main><article><div class="parentlink"><b>Namespace:</b> <a href="namespace_webdriver_logging.html">webdriver.logging</a></div><div class="codelink"><a href="source/lib/webdriver/logging.js.src.html#l82">View Source</a></div><h1>class Logger</h1><p>The Logger is an object used for logging debug messages. Loggers are
normally named, using a hierarchical dot-separated namespace. Logger names
can be arbitrary strings, but they should normally be based on the package
name or class name of the logged component, such as goog.net.BrowserChannel.</p>
<p>The Logger object is loosely based on the java class
java.util.logging.Logger. It supports different levels of filtering for
different loggers.</p>
<p>The logger object should never be instantiated by application code. It
should always use the goog.debug.Logger.getLogger function.</p>
<h3>new Logger(<wbr>name)</h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>name<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The name of the Logger.</p>
</dl></div></div><h2>Instance Methods</h2><div id="addHandler" class="function"><div><h3>addHandler(<wbr>handler)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l400">code »</a></span></h3><p>Adds a handler to the logger. This doesn't use the event system because
we want to be able to add logging to the event system.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>handler<code>Function</code><dd><p>Handler function to add.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="config" class="function"><div><h3>config(<wbr>msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l639">code »</a></span></h3><p>Logs a message at the Logger.Level.CONFIG level.
If the logger is currently enabled for the given message level then the
given message is forwarded to all the registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>=</code><dd><p>An exception associated with the message.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="fine" class="function"><div><h3>fine(<wbr>msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l653">code »</a></span></h3><p>Logs a message at the Logger.Level.FINE level.
If the logger is currently enabled for the given message level then the
given message is forwarded to all the registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>=</code><dd><p>An exception associated with the message.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="finer" class="function"><div><h3>finer(<wbr>msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l667">code »</a></span></h3><p>Logs a message at the Logger.Level.FINER level.
If the logger is currently enabled for the given message level then the
given message is forwarded to all the registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>=</code><dd><p>An exception associated with the message.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="finest" class="function"><div><h3>finest(<wbr>msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l681">code »</a></span></h3><p>Logs a message at the Logger.Level.FINEST level.
If the logger is currently enabled for the given message level then the
given message is forwarded to all the registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>=</code><dd><p>An exception associated with the message.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="getChildren" class="function"><div><h3>getChildren()<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l448">code »</a></span></h3><p>Returns the children of this logger as a map of the child name to the logger.</p>
<div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd><p>The map where the keys are the child leaf names and the
values are the Logger objects.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="getEffectiveLevel" class="function"><div><h3>getEffectiveLevel()<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l498">code »</a></span></h3><p>Returns the effective level of the logger based on its ancestors' levels.</p>
<div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_logging_Level.html">webdriver.logging.Level</a></code><dd><p>The level.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="getLevel" class="function"><div><h3>getLevel()<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l488">code »</a></span></h3><p>Gets the log level specifying which message levels will be logged by this
logger. Message levels lower than this value will be discarded.
The level value Level.OFF can be used to turn off logging. If the level
is null, it means that this node should inherit its level from its nearest
ancestor with a specific (non-null) level value.</p>
<div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_logging_Level.html">webdriver.logging.Level</a></code><dd><p>The level.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="getLogRecord" class="function"><div><h3>getLogRecord(<wbr>level, msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l561">code »</a></span></h3><p>Creates a new log record and adds the exception (if present) to it.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>level<code><a href="class_webdriver_logging_Level.html">webdriver.logging.Level</a></code><dd><p>One of the level identifiers.</p>
<dt>msg<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The string message.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd><p>An exception associated with the
message.</p>
</dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_logging_LogRecord.html">webdriver.logging.LogRecord</a></code><dd><p>A log record.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="getName" class="function"><div><h3>getName()<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l390">code »</a></span></h3><p>Gets the name of this logger.</p>
<div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The name of this logger.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="getParent" class="function"><div><h3>getParent()<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l438">code »</a></span></h3><p>Returns the parent of this logger.</p>
<div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_logging_Logger.html">webdriver.logging.Logger</a></code><dd><p>The parent logger or null if this is the root.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="info" class="function"><div><h3>info(<wbr>msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l625">code »</a></span></h3><p>Logs a message at the Logger.Level.INFO level.
If the logger is currently enabled for the given message level then the
given message is forwarded to all the registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>=</code><dd><p>An exception associated with the message.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="isLoggable" class="function"><div><h3>isLoggable(<wbr>level)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l524">code »</a></span></h3><p>Checks if a message of the given level would actually be logged by this
logger. This check is based on the Loggers effective level, which may be
inherited from its parent.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>level<code><a href="class_webdriver_logging_Level.html">webdriver.logging.Level</a></code><dd><p>The level to check.</p>
</dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd><p>Whether the message would be logged.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="log" class="function"><div><h3>log(<wbr>level, msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l539">code »</a></span></h3><p>Logs a message. If the logger is currently enabled for the
given message level then the given message is forwarded to all the
registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>level<code><a href="class_webdriver_logging_Level.html">webdriver.logging.Level</a></code><dd><p>One of the level identifiers.</p>
<dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd><p>An exception associated with the
message.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="logRecord" class="function"><div><h3>logRecord(<wbr>logRecord)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l694">code »</a></span></h3><p>Logs a LogRecord. If the logger is currently enabled for the
given message level then the given message is forwarded to all the
registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>logRecord<code><a href="class_webdriver_logging_LogRecord.html">webdriver.logging.LogRecord</a></code><dd><p>A log record to log.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="removeHandler" class="function"><div><h3>removeHandler(<wbr>handler)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l423">code »</a></span></h3><p>Removes a handler from the logger. This doesn't use the event system because
we want to be able to add logging to the event system.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>handler<code>Function</code><dd><p>Handler function to remove.</p>
</dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd><p>Whether the handler was removed.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="setLevel" class="function"><div><h3>setLevel(<wbr>level)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l465">code »</a></span></h3><p>Set the log level specifying which message levels will be logged by this
logger. Message levels lower than this value will be discarded.
The level value Level.OFF can be used to turn off logging. If the new level
is null, it means that this node should inherit its level from its nearest
ancestor with a specific (non-null) level value.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>level<code><a href="class_webdriver_logging_Level.html">webdriver.logging.Level</a></code><dd><p>The new level.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="severe" class="function"><div><h3>severe(<wbr>msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l597">code »</a></span></h3><p>Logs a message at the Logger.Level.SEVERE level.
If the logger is currently enabled for the given message level then the
given message is forwarded to all the registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>=</code><dd><p>An exception associated with the message.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="shout" class="function"><div><h3>shout(<wbr>msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l583">code »</a></span></h3><p>Logs a message at the Logger.Level.SHOUT level.
If the logger is currently enabled for the given message level then the
given message is forwarded to all the registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>=</code><dd><p>An exception associated with the message.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="warning" class="function"><div><h3>warning(<wbr>msg, opt_exception)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l611">code »</a></span></h3><p>Logs a message at the Logger.Level.WARNING level.
If the logger is currently enabled for the given message level then the
given message is forwarded to all the registered output Handler objects.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|function(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd><p>The message to log.</p>
<dt>opt_exception<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>=</code><dd><p>An exception associated with the message.</p>
</dl></div></div></div></div><h2>Static Functions</h2><div id="Logger.getLogger" class="function"><div><h3>Logger.getLogger(<wbr>name)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l355">code »</a></span></h3><div class="tags"><span>deprecated</span></div><p>Finds or creates a logger for a named subsystem. If a logger has already been
created with the given name it is returned. Otherwise a new logger is
created. If a new logger is created its log level will be configured based
on the LogManager configuration and it will configured to also send logging
output to its parent's handlers. It will be registered in the LogManager
global namespace.</p>
<dl><dt>Deprecated<dd><p>use goog.log instead. http://go/goog-debug-logger-deprecated</p>
</dl><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>name<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>A name for the logger. This should be a dot-separated
name and should normally be based on the package name or class name of the
subsystem, such as goog.net.BrowserChannel.</p>
</dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_logging_Logger.html">webdriver.logging.Logger</a></code><dd><p>The named logger.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="Logger.logToProfilers" class="function"><div><h3>Logger.logToProfilers(<wbr>msg)<span class="codelink"><a href="source/lib/goog/debug/logger.js.src.html#l366">code »</a></span></h3><p>Logs a message to profiling tools, if available.
https://developers.google.com/web-toolkit/speedtracer/logging-api
http://msdn.microsoft.com/en-us/library/dd433074(VS.85).aspx</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>msg<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The message to log.</p>
</dl></div></div></div></div><h2>Static Properties</h2><div id="Logger.ROOT_LOGGER_NAME" class="property"><dl><dt><a href="source/lib/goog/debug/logger.js.src.html#l101">Logger.ROOT_LOGGER_NAME</a><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>No description.</dl></div><h2>Compiler Constants</h2><div id="Logger.ENABLE_HIERARCHY" class="property"><dl><dt><a href="source/lib/goog/debug/logger.js.src.html#l109">Logger.ENABLE_HIERARCHY</a><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd><p>Toggles whether loggers other than the root logger can have
log handlers attached to them and whether they can have their log level
set. Logging is a bit faster when this is set to false.</p>
</dl></div></article><nav><h3><a href="index.html" tabindex="2">Overview</a></h3><div><input type="checkbox" id="nav-modules" checked/><label for="nav-modules"><h3><span class="selectable" tabindex="2">Modules</span></h3></label><div id="nav-modules-view"></div></div><div><input type="checkbox" id="nav-types" checked/><label for="nav-types"><h3><span class="selectable" tabindex="2">Types</span></h3></label><div id="nav-types-view"></div></div><h3><a href="Changes.html" tabindex="2">Changes</a></h3></nav></main><footer><div><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></div></footer><script src="types.js"></script><script src="dossier.js"></script>