Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ This library is included by default in the openHAB [JavaScript Scripting add-on]
- [Cache](#cache)
- [Time](#time)
- [Quantity](#quantity)
- [Log](#log)
- [Utils](#utils)
- [Environment](#environment)
- [Rules created from Script Files](#rules-created-from-script-files)
Expand Down Expand Up @@ -282,12 +281,12 @@ The JS Scripting binding supports the standard `console` object for logging.
Script logging is enabled by default at the `INFO` level (messages from `console.debug` and `console.trace` won't be displayed), but can be configured using the [openHAB console](https://www.openhab.org/docs/administration/console.html):

```text
log:set DEBUG org.openhab.automation.script
log:set TRACE org.openhab.automation.script
log:set DEFAULT org.openhab.automation.script
log:set DEBUG org.openhab.automation.jsscripting
log:set TRACE org.openhab.automation.jsscripting
log:set DEFAULT org.openhab.automation.jsscripting
```

The default logger name consists of the prefix `org.openhab.automation.script` and the script’s individual part `.file.filename` or `.ui.ruleUID`.
The default logger name consists of the prefix `org.openhab.automation.jsscripting` and the script’s individual part `.file.<filename>`, `.rule.<ruleUID>`, or `.transformation.<transformationUID>`.
This logger name can be changed by assigning a new string to the `loggerName` property of the console:

```javascript
Expand Down Expand Up @@ -1365,18 +1364,6 @@ For the string the same rules apply as described above.

See [openhab-js : Quantity](https://openhab.github.io/openhab-js/Quantity.html) for full API documentation.

### Log

By default, the JS Scripting binding supports console logging like `console.log()` and `console.debug()` to the openHAB default log.
Additionally, scripts may create their own native openHAB logger using the log namespace.

```javascript
var logger = log('my_logger');

//prints "Hello World!"
logger.debug("Hello {}!", "world");
```

### Utils

openHAB internally is a Java program.
Expand Down