openhab-core/bundles/org.openhab.core.io.rest.log
Wouter Born 2babea4c9a
Update license headers to 2024 (#4011)
Signed-off-by: Wouter Born <github@maindrain.net>
2024-01-03 21:20:34 +01:00
..
src/main/java/org/openhab/core/io/rest/log/internal Update license headers to 2024 (#4011) 2024-01-03 21:20:34 +01:00
.classpath Update Eclipse .classpath files (#3250) 2022-12-22 14:14:35 +01:00
.project mavenize openHAB and integrate mavenized ESH repository (#467) 2019-01-28 13:07:31 +01:00
NOTICE Updated NOTICE files to openHAB (#578) 2019-02-15 10:46:18 +01:00
pom.xml Apply spotless after release, resolve bundles (#3953) 2023-12-22 23:14:28 +01:00
README.md Replaces 'Eclipse SmartHome' with 'openHAB' in text (#581) 2019-02-15 10:46:37 +01:00

FORMAT: 1A

openHAB UI Logging Bundle

This Bundle provides a resource at the REST API to enable a consumer to fetch the set log levels. It also receives log messages which will be logged to the server's log. The last logged messages by this API can be requested to be displayed in UIs.

Meta: This document is in normal markdown format, but also compatible to Apiary for automatic doc generation and API testing.

Log levels [/rest/log/levels]

Get enabled log levels [GET]

This depends on the current log settings at the backend.

  • Response 200 (application/json)

      {
          "warn": true,
          "error": true,
          "debug": true,
          "info": true
      }
    

Log [/rest/log]

Send log message [POST]

  • Request (application/json)

    • Attributes

      • severity (enum[string], required) - The severity of the log message

        • Members
          • error
          • warn
          • info
          • debug
      • url (string, optional) - The URL where the log event ocurred.

      • message (string, optional) - The message to log.

    • Body

        {
            "severity" : "error",
            "url" : "http://exmple.org/",
            "message" : "A test message"
        }
      
  • Response 200

  • Response 403 (application/json)

    • Attributes

      • error (string)
      • severity (string)
    • Body

        {
             "error": "Your log severity is not supported.",
             "severity": "info"
        }
      

Log [/rest/log/{limit}]

Get last log messages [GET]

Return the last log entries received by /rest/log/.

  • Parameters

    • limit (number, optional) - Limit the amount of messages.

      On invalid input, limit is set to it's default.

      • Default: 500
  • Response 200 (application/json)

    • Attributes

      • timestamp (number) - UTC milliseconds from the epoch.

        In JavaScript, you can use this value for constructing a Date.

      • severity (enum[string])

        • Members
          • error
          • warn
          • info
          • debug
      • url (string)

      • message (string)

    • Body

        [
          {
            "timestamp": 1450531459479,
            "severity": "error",
            "url": "http://example.com/page1",
            "message": "test 5"
          },
          {
            "timestamp": 1450531459655,
            "severity": "error",
            "url": "http://example.com/page1",
            "message": "test 6"
          },
          {
            "timestamp": 1450531460038,
            "severity": "error",
            "url": "http://example.com/page2",
            "message": "test 7"
          }
        ]