You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Loggers class uses hierarchical, dot-delimited namespaces (e.g. "" > "webdriver" > "webdriver.logging"). For example, the following code will give a hierarchy of loggers:</p>
To log messages at the given level pass the level in the <i>`log()`</i> method:</p>
118
+
<pre>
119
+
logger.log(logging.Level.INFO, 'This is an info message')
120
+
</pre>
121
+
<br>
122
+
<p>You can also use the instance methods to target logs of a particular level:<p>
123
+
<pre>
124
+
logger.finest('this is the finest message')
125
+
logger.finer('this is a finer message')
126
+
logger.info('this is an info message')
127
+
logger.warning('this is a warning message')
128
+
logger.severe('this is a severe message')
129
+
</pre>
130
+
<br>
131
+
<p>By default the logger's level is <i>`Level.OFF`.</i> To change the level of the logger:</p>
132
+
<pre>
133
+
logger.setLevel(logging.Level.INFO)
134
+
</pre>
135
+
<br>
136
+
<p><b>3. Log Output:</b></p>
137
+
138
+
<p>As opposed to ruby which by default sends logs to console in stdout, JS has the option to add a handler. The handler will be invoked for each message logged with this instance, or any of its descendants.</p>
139
+
<pre>
140
+
logger.addHandler(callback)
141
+
</pre>
142
+
<br>
143
+
<p>JS has provided a method to add console handler to the given logger. The console handler will log all messages using the JavaScript Console API:</p>
144
+
<pre>
145
+
logging.addConsoleHandler(logger)
146
+
</pre>
147
+
<br>
148
+
<p>Similarly, to add console handler to the root logger:</p>
<p>JS gives the ability to define log preference for a remote WebDriver session. There are 5 common log types: <i>`BROWSER`, `CLIENT`, `DRIVER`, `PERFORMANCE`, `SERVER`</i>.</p>
156
+
157
+
<p>To set a log level for a particular log type:</p>
Loggers class uses hierarchical, dot-delimited namespaces (e.g. "" > "webdriver" > "webdriver.logging"). For example, the following code will give a hierarchy of loggers:
The basic levels for JS loggers are: `OFF`, `SEVERE`, `WARNING`, `INFO`, `DEBUG`, `FINE`, `FINER`, `FINEST`, `ALL`.
107
-
To log messages at the given level pass the level in the `log()` method:
108
-
```js
109
-
logger.log(logging.Level.INFO, 'This is an info message')
110
-
```
111
-
112
-
You can also use the instance methods to target logs of a particular level:
113
-
```js
114
-
logger.finest('this is the finest message')
115
-
logger.finer('this is a finer message')
116
-
logger.info('this is an info message')
117
-
logger.warning('this is a warning message')
118
-
logger.severe('this is a severe message')
119
-
```
120
-
121
-
By default the logger's level is `Level.OFF`
122
-
To change the level of the logger:
123
-
```js
124
-
logger.setLevel(logging.Level.INFO)
125
-
```
126
-
127
-
### 3. Log Output:
128
-
129
-
As opposed to ruby which by default sends logs to console in stdout, JS has the option to add a handler. The handler will be invoked for each message logged with this instance, or any of its descendants.
130
-
```js
131
-
logger.addHandler(callback)
132
-
```
133
-
134
-
JS has provided a method to add console handler to the given logger. The console handler will log all messages using the JavaScript Console API:
135
-
```js
136
-
logging.addConsoleHandler(logger)
137
-
```
138
-
139
-
Similarly, to add console handler to the root logger:
140
-
```js
141
-
logging.installConsoleHandler()
142
-
```
143
-
144
-
### 4. Logging Preference (remote logging API):
145
-
146
-
JS gives the ability to define log preference for a remote WebDriver session. There are 5 common log types: `BROWSER`, `CLIENT`, `DRIVER`, `PERFORMANCE`, `SERVER`
0 commit comments