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
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
107
To log messages at the given level pass the level in the `log()` method:
108
-
```
108
+
```js
109
109
logger.log(logging.Level.INFO, 'This is an info message')
110
110
```
111
111
112
112
You can also use the instance methods to target logs of a particular level:
113
-
```
113
+
```js
114
114
logger.finest('this is the finest message')
115
115
logger.finer('this is a finer message')
116
116
logger.info('this is an info message')
@@ -120,24 +120,24 @@ logger.severe('this is a severe message')
120
120
121
121
By default the logger's level is `Level.OFF`
122
122
To change the level of the logger:
123
-
```
123
+
```js
124
124
logger.setLevel(logging.Level.INFO)
125
125
```
126
126
127
127
### 3. Log Output:
128
128
129
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
-
```
130
+
```js
131
131
logger.addHandler(callback)
132
132
```
133
133
134
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
-
```
135
+
```js
136
136
logging.addConsoleHandler(logger)
137
137
```
138
138
139
139
Similarly, to add console handler to the root logger:
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