Skip to content

Latest commit

 

History

History
167 lines (108 loc) · 7.3 KB

README.md

File metadata and controls

167 lines (108 loc) · 7.3 KB

Log

(log)

Overview

Submit logs to the Log Handler for Plex Media Server

Available Operations

log_line

This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new(
      client_id: "3381b62b-9ab7-4e37-827b-203e9809eb58",
      client_name: "Plex for Roku",
      client_version: "2.4.1",
      platform: "Roku",
      device_nickname: "Roku 3",
    )
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.log.log_line(level=::PlexRubySDK::Operations::Level::THREE, message="Test log message", source="Postman")

if res.status_code == 200
  # handle response
end

Parameters

Parameter Type Required Description Example
level ::PlexRubySDK::Operations::Level ✔️ An integer log level to write to the PMS log with.
0: Error
1: Warning
2: Info
3: Debug
4: Verbose
message ::String ✔️ The text of the message to write to the log. Test log message
source ::String ✔️ a string indicating the source of the message. Postman

Response

T.nilable(::PlexRubySDK::Operations::LogLineResponse)

log_multi_line

This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
It accepts a text/plain request body, where each line represents a distinct log entry.
Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'.

Log entries are separated by a newline character (\n).
Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.

The 'level' parameter specifies the log entry's severity or importance, with the following integer values:

  • 0: Error - Critical issues that require immediate attention.
  • 1: Warning - Important events that are not critical but may indicate potential issues.
  • 2: Info - General informational messages about system operation.
  • 3: Debug - Detailed information useful for debugging purposes.
  • 4: Verbose - Highly detailed diagnostic information for in-depth analysis.

The 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module).

Example of a single log entry format: level=4&message=Sample%20log%20entry&source=applicationName

Ensure each parameter is properly URL-encoded to avoid interpretation issues.

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new(
      client_id: "3381b62b-9ab7-4e37-827b-203e9809eb58",
      client_name: "Plex for Roku",
      client_version: "2.4.1",
      platform: "Roku",
      device_nickname: "Roku 3",
    )
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)


req = "level=4&message=Test%20message%201&source=postman
level=3&message=Test%20message%202&source=postman
level=1&message=Test%20message%203&source=postman"
    
res = s.log.log_multi_line(req)

if res.status_code == 200
  # handle response
end

Parameters

Parameter Type Required Description
request ::String ✔️ The request object to use for the request.

Response

T.nilable(::PlexRubySDK::Operations::LogMultiLineResponse)

enable_paper_trail

This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new(
      client_id: "3381b62b-9ab7-4e37-827b-203e9809eb58",
      client_name: "Plex for Roku",
      client_version: "2.4.1",
      platform: "Roku",
      device_nickname: "Roku 3",
    )
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.log.enable_paper_trail()

if res.status_code == 200
  # handle response
end

Response

T.nilable(::PlexRubySDK::Operations::EnablePaperTrailResponse)