diff --git a/docs/api/logs.rst b/docs/api/logs.rst index ee1c19561..f357494df 100644 --- a/docs/api/logs.rst +++ b/docs/api/logs.rst @@ -4,172 +4,9 @@ Log file management ******************* -.. note:: +Log file management (and logging configuration) was moved into a bundled plugin in OctoPrint 1.3.7. Refer to +:ref:`the Logging's plugins API ` for the API documentation. - All log file management operations require admin rights. - -.. contents:: - -.. _sec-api-logs-list: - -Retrieve a list of available log files -====================================== - -.. http:get:: /api/logs - - Retrieve information regarding all log files currently available and regarding the disk space still available - in the system on the location the log files are being stored. - - Returns a :ref:`Logfile Retrieve response `. - - **Example** - - .. sourcecode:: http - - GET /api/logs HTTP/1.1 - Host: example.com - X-Api-Key: abcdef... - - .. sourcecode:: http - - HTTP/1.1 200 OK - Content-Type: application/json - - { - "files" : [ - { - "date" : 1393158814, - "name" : "octoprint.log", - "size" : 43712, - "refs": { - "resource": "http://example.com/api/logs/octoprint.log", - "download": "http://example.com/downloads/logs/octoprint.log" - } - }, - { - "date" : 1392628936, - "name" : "octoprint.log.2014-02-17", - "size" : 13205, - "refs": { - "resource": "http://example.com/api/logs/octoprint.log.2014-02-17", - "download": "http://example.com/downloads/logs/octoprint.log.2014-02-17" - } - }, - { - "date" : 1393158814, - "name" : "serial.log", - "size" : 1798419, - "refs": { - "resource": "http://example.com/api/logs/serial.log", - "download": "http://example.com/downloads/logs/serial.log" - } - } - ], - "free": 12237201408 - } - - :statuscode 200: No error - :statuscode 403: If the given API token did not have admin rights associated with it - -.. _sec-api-logs-delete: - -Delete a specific logfile -========================= - -.. http:delete:: /api/logs/(path:filename) - - Delete the selected log file with name `filename`. - - Returns a :http:statuscode:`204` after successful deletion. - - **Example Request** - - .. sourcecode:: http - - DELETE /api/logs/octoprint.log.2014-02-17 HTTP/1.1 - Host: example.com - X-Api-Key: abcdef... - - :param filename: The filename of the log file to delete - :statuscode 204: No error - :statuscode 403: If the given API token did not have admin rights associated with it - :statuscode 404: If the file was not found - -.. _sec-api-logs-datamodel: - -Data model -========== - -.. _sec-api-logs-datamodel-retrieveresponse: - -Logfile Retrieve Response -------------------------- - -.. list-table:: - :widths: 15 5 10 30 - :header-rows: 1 - - * - Name - - Multiplicity - - Type - - Description - * - ``files`` - - 0..* - - Array of :ref:`File information items ` - - The list of requested files. Might be an empty list if no files are available - * - ``free`` - - 1 - - String - - The amount of disk space in bytes available in the local disk space (refers to OctoPrint's ``logs`` folder). - -.. _sec-api-logs-datamodel-fileinfo: - -File information ----------------- - -.. list-table:: - :widths: 15 5 10 30 - :header-rows: 1 - - * - Name - - Multiplicity - - Type - - Description - * - ``name`` - - 1 - - String - - The name of the file - * - ``size`` - - 1 - - Number - - The size of the file in bytes. - * - ``date`` - - 1 - - Unix timestamp - - The timestamp when this file was last modified. - * - ``refs`` - - 1 - - :ref:`sec-api-logs-datamodel-ref` - - References relevant to this file - -.. _sec-api-logs-datamodel-ref: - -References ----------- - -.. list-table:: - :widths: 15 5 10 30 - :header-rows: 1 - - * - Name - - Multiplicity - - Type - - Description - * - ``resource`` - - 1 - - URL - - The resource that represents the file (e.g. for deleting) - * - ``download`` - - 1 - - URL - - The download URL for the file +The former endpoints ``/api/logs`` and ``api/logs/`` are marked as deprecated but still work for now. New +client implementations should directly use the new endpoints provided by the bundled plugin. Existing implementations +should adapt their endpoints as soon as possible. diff --git a/docs/bundledplugins/cura.rst b/docs/bundledplugins/cura.rst index aac96397f..d365e9ac3 100644 --- a/docs/bundledplugins/cura.rst +++ b/docs/bundledplugins/cura.rst @@ -1,4 +1,4 @@ -.. _sec-bundledplugins_cura: +.. _sec-bundledplugins-cura: Cura ==== diff --git a/docs/bundledplugins/index.rst b/docs/bundledplugins/index.rst index d5935a96a..53516474c 100644 --- a/docs/bundledplugins/index.rst +++ b/docs/bundledplugins/index.rst @@ -9,5 +9,6 @@ Bundled Plugins cura.rst discovery.rst + logging.rst pluginmanager.rst softwareupdate.rst diff --git a/docs/bundledplugins/logging.rst b/docs/bundledplugins/logging.rst new file mode 100644 index 000000000..0fccc9e1a --- /dev/null +++ b/docs/bundledplugins/logging.rst @@ -0,0 +1,238 @@ +.. _sec-bundledplugins-logging: + +Logging +======= + +The OctoPrint Logging plugin comes bundled with OctoPrint starting with version 1.3.7. + +It implements the log management functionality that was formerly part of the core application and adds features to +configure logging levels for sub modules through the included settings dialog. + +.. _fig-bundledplugins-pluginmanager-mainscreen: +.. figure:: ../images/bundledplugins-logging-settings.png + :align: center + :alt: Logging plugin + + The settings dialog of the Logging plugin + +.. _sec-bundledplugins-logging-api: + +API +--- + +.. note:: + + All log file management operations require admin rights. + +.. _sec-bundledplugins-logging-api-list_logs: + +Retrieve a list of available log files +++++++++++++++++++++++++++++++++++++++ + +.. http:get:: /plugin/logging/logs + + Retrieve information regarding all log files currently available and regarding the disk space still available + in the system on the location the log files are being stored. + + Returns a :ref:`Logfile Retrieve response `. + + **Example** + + .. sourcecode:: http + + GET /plugin/logging/logs HTTP/1.1 + Host: example.com + X-Api-Key: abcdef... + + .. sourcecode:: http + + HTTP/1.1 200 OK + Content-Type: application/json + + { + "files" : [ + { + "date" : 1393158814, + "name" : "octoprint.log", + "size" : 43712, + "refs": { + "resource": "http://example.com/plugin/logging/logs/octoprint.log", + "download": "http://example.com/downloads/logs/octoprint.log" + } + }, + { + "date" : 1392628936, + "name" : "octoprint.log.2014-02-17", + "size" : 13205, + "refs": { + "resource": "http://example.com/plugin/logging/logs/octoprint.log.2014-02-17", + "download": "http://example.com/downloads/logs/octoprint.log.2014-02-17" + } + }, + { + "date" : 1393158814, + "name" : "serial.log", + "size" : 1798419, + "refs": { + "resource": "http://example.com/plugin/logging/logs/serial.log", + "download": "http://example.com/downloads/logs/serial.log" + } + } + ], + "free": 12237201408 + } + + :statuscode 200: No error + :statuscode 403: If the given API token did not have admin rights associated with it + +.. _sec-bundledplugins-logging-api-delete_logs: + +Delete a specific logfile ++++++++++++++++++++++++++ + +.. http:delete:: /plugin/logging/logs/(path:filename) + + Delete the selected log file with name `filename`. + + Returns a :http:statuscode:`204` after successful deletion. + + **Example Request** + + .. sourcecode:: http + + DELETE /plugin/logging/logs/octoprint.log.2014-02-17 HTTP/1.1 + Host: example.com + X-Api-Key: abcdef... + + :param filename: The filename of the log file to delete + :statuscode 204: No error + :statuscode 403: If the given API token did not have admin rights associated with it + :statuscode 404: If the file was not found + +.. _sec-bundledplugins-logging-api-datamodel: + +Data model +++++++++++ + +.. _sec-bundledplugins-logging-api-datamodel-retrieveresponse: + +Logfile Retrieve Response +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :widths: 15 5 10 30 + :header-rows: 1 + + * - Name + - Multiplicity + - Type + - Description + * - ``files`` + - 0..* + - Array of :ref:`File information items ` + - The list of requested files. Might be an empty list if no files are available + * - ``free`` + - 1 + - String + - The amount of disk space in bytes available in the local disk space (refers to OctoPrint's ``logs`` folder). + +.. _sec-bundledplugins-logging-api-datamodel-fileinfo: + +File information +~~~~~~~~~~~~~~~~ + +.. list-table:: + :widths: 15 5 10 30 + :header-rows: 1 + + * - Name + - Multiplicity + - Type + - Description + * - ``name`` + - 1 + - String + - The name of the file + * - ``size`` + - 1 + - Number + - The size of the file in bytes. + * - ``date`` + - 1 + - Unix timestamp + - The timestamp when this file was last modified. + * - ``refs`` + - 1 + - :ref:`References ` + - References relevant to this file + +.. _sec-bundledplugins-logging-api-datamodel-ref: + +References +~~~~~~~~~~ + +.. list-table:: + :widths: 15 5 10 30 + :header-rows: 1 + + * - Name + - Multiplicity + - Type + - Description + * - ``resource`` + - 1 + - URL + - The resource that represents the file (e.g. for deleting) + * - ``download`` + - 1 + - URL + - The download URL for the file + +.. _sec-bundledplugins-logging-jsclientlib: + +JS Client Library +----------------- + +:mod:`OctoPrintClient.plugins.logging` +-------------------------------------- + +.. note:: + + All methods here require that the used API token or a the existing browser session + has admin rights. + +.. js:function:: OctoPrintClient.plugins.logging.listLogs(opts) + + Retrieves a list of log files. + + See :ref:`Retrieve a list of available log files ` for details. + + :param object opts: Additional options for the request + :returns Promise: A `jQuery Promise `_ for the request's response + +.. js:function:: OctoPrintClient.plugins.logging.deleteLog(path, opts) + + Deletes the specified log ``path``. + + See :ref:`Delete a specific log file ` for details. + + :param string path: The path to the log file to delete + :param object opts: Additional options for the request + :returns Promise: A `jQuery Promise `_ for the request's response + +.. js:function:: OctoPrintClient.plugins.logging.downloadLog(path, opts) + + Downloads the specified log ``file``. + + See :js:func:`OctoPrint.download` for more details on the underlying library download mechanism. + + :param string path: The path to the log file to download + :param object opts: Additional options for the request + :returns Promise: A `jQuery Promise `_ for the request's response + +.. _sec-bundledplugins-logging-sourcecode: + +Source Code +----------- + +The source of the Logging plugin is bundled with OctoPrint and can be found in its source repository under ``src/octoprint/plugins/logging``. diff --git a/docs/images/bundledplugins-logging-settings.png b/docs/images/bundledplugins-logging-settings.png new file mode 100644 index 000000000..c5b761246 Binary files /dev/null and b/docs/images/bundledplugins-logging-settings.png differ diff --git a/docs/jsclientlib/logs.rst b/docs/jsclientlib/logs.rst index 41d928661..fae86fb55 100644 --- a/docs/jsclientlib/logs.rst +++ b/docs/jsclientlib/logs.rst @@ -3,37 +3,9 @@ :mod:`OctoPrintClient.logs` --------------------------- -.. note:: - - All methods here require that the used API token or a the existing browser session - has admin rights. - -.. js:function:: OctoPrintClient.logs.list(opts) - - Retrieves a list of log files. - - See :ref:`Retrieve a list of available log files ` for details. - - :param object opts: Additional options for the request - :returns Promise: A `jQuery Promise `_ for the request's response - -.. js:function:: OctoPrintClient.logs.delete(path, opts) - - Deletes the specified log ``path``. - - See :ref:`Delete a specific log file ` for details. - - :param string path: The path to the log file to delete - :param object opts: Additional options for the request - :returns Promise: A `jQuery Promise `_ for the request's response - -.. js:function:: OctoPrintClient.logs.download(path, opts) - - Downloads the specified log ``file``. - - See :js:func:`OctoPrint.download` for more details on the underlying library download mechanism. - - :param string path: The path to the log file to download - :param object opts: Additional options for the request - :returns Promise: A `jQuery Promise `_ for the request's response +Log file management (and logging configuration) was moved into a bundled plugin in OctoPrint 1.3.7. Refer to +:ref:`the Logging's plugins JS Client Library ` for the JS Client documentation. +The former module ``OctoPrintClient.logs`` and its methods are marked as deprecated but still work for now. New +client implementations should directly use the new module provided by the bundled plugin. Existing implementations +should adapt their used module as soon as possible.