mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 04:20:46 +00:00
4.8 KiB
4.8 KiB
Log
(Log)
Overview
Submit logs to the Log Handler for Plex Media Server
Available Operations
- LogLine - Logging a single line message.
- LogMultiLine - Logging a multi-line message
- EnablePaperTrail - Enabling Papertrail
LogLine
This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
Example Usage
using PlexAPI;
using PlexAPI.Models.Components;
using PlexAPI.Models.Requests;
var sdk = new PlexAPISDK(
security: new Models.Components.Security() {
AccessToken = "<YOUR_API_KEY_HERE>",
});
var res = await sdk.Log.LogLineAsync(Level: Level.Three, Message: "string", Source: "string");
// handle response
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
Level |
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. | |
Source |
string | ✔️ | a string indicating the source of the message. |
Response
LogMultiLine
This endpoint will write multiple lines to the main Plex Media Server log in a single request. It takes a set of query strings as would normally sent to the above GET endpoint as a linefeed-separated block of POST data. The parameters for each query string match as above.
Example Usage
using PlexAPI;
using PlexAPI.Models.Components;
var sdk = new PlexAPISDK(
security: new Models.Components.Security() {
AccessToken = "<YOUR_API_KEY_HERE>",
});
var res = await sdk.Log.LogMultiLineAsync();
// handle response
Response
EnablePaperTrail
This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
Example Usage
using PlexAPI;
using PlexAPI.Models.Components;
var sdk = new PlexAPISDK(
security: new Models.Components.Security() {
AccessToken = "<YOUR_API_KEY_HERE>",
});
var res = await sdk.Log.EnablePaperTrailAsync();
// handle response