Skip to content

Commit 74306ff

Browse files
committed
[js] add js annotations
1 parent a2bfca1 commit 74306ff

File tree

1 file changed

+11
-11
lines changed
  • website_and_docs/content/documentation/webdriver/troubleshooting

1 file changed

+11
-11
lines changed

website_and_docs/content/documentation/webdriver/troubleshooting/logging.en.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,23 @@ JS has implemented logging APIs. It has also added LogManager to maintain a coll
7878

7979
### 1. Getting a logger can be done in two ways:
8080

81-
```
81+
```js
8282
const logging = require('selenium-webdriver/lib/logging')
8383
```
8484

8585
First method using manager
86-
```
86+
```js
8787
mgr = new logging.LogManager()
8888
logger = mgr.getLogger('')
8989
```
9090

9191
Second method without manager
92-
```
92+
```js
9393
logger = logging.getLogger('')
9494
```
9595

9696
Loggers class uses hierarchical, dot-delimited namespaces (e.g. "" > "webdriver" > "webdriver.logging"). For example, the following code will give a hierarchy of loggers:
97-
```
97+
```js
9898
logger = mgr.getLogger('foo.bar.baz')
9999
```
100100

@@ -105,12 +105,12 @@ logger = mgr.getLogger('foo.bar.baz')
105105

106106
The basic levels for JS loggers are: `OFF`, `SEVERE`, `WARNING`, `INFO`, `DEBUG`, `FINE`, `FINER`, `FINEST`, `ALL`.
107107
To log messages at the given level pass the level in the `log()` method:
108-
```
108+
```js
109109
logger.log(logging.Level.INFO, 'This is an info message')
110110
```
111111

112112
You can also use the instance methods to target logs of a particular level:
113-
```
113+
```js
114114
logger.finest('this is the finest message')
115115
logger.finer('this is a finer message')
116116
logger.info('this is an info message')
@@ -120,24 +120,24 @@ logger.severe('this is a severe message')
120120

121121
By default the logger's level is `Level.OFF`
122122
To change the level of the logger:
123-
```
123+
```js
124124
logger.setLevel(logging.Level.INFO)
125125
```
126126

127127
### 3. Log Output:
128128

129129
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
131131
logger.addHandler(callback)
132132
```
133133

134134
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
136136
logging.addConsoleHandler(logger)
137137
```
138138

139139
Similarly, to add console handler to the root logger:
140-
```
140+
```js
141141
logging.installConsoleHandler()
142142
```
143143

@@ -146,7 +146,7 @@ logging.installConsoleHandler()
146146
JS gives the ability to define log preference for a remote WebDriver session. There are 5 common log types: `BROWSER`, `CLIENT`, `DRIVER`, `PERFORMANCE`, `SERVER`
147147

148148
To set a log level for a particular log type:
149-
```
149+
```js
150150
let prefs = new logging.Preferences()
151151
prefs.setLevel(logging.Type.BROWSER, logging.Level.FINE)
152152
```

0 commit comments

Comments
 (0)