mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
157 lines
15 KiB
Markdown
157 lines
15 KiB
Markdown
# Log
|
|
(*log*)
|
|
|
|
## Overview
|
|
|
|
Submit logs to the Log Handler for Plex Media Server
|
|
|
|
|
|
### Available Operations
|
|
|
|
* [logLine](#logline) - Logging a single line message.
|
|
* [logMultiLine](#logmultiline) - Logging a multi-line message
|
|
* [enablePaperTrail](#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
|
|
|
|
```typescript
|
|
import { SDK } from "openapi";
|
|
import { Level } from "openapi/models/operations";
|
|
|
|
async function run() {
|
|
const sdk = new SDK({
|
|
accessToken: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
const level = Level.Three;
|
|
const message = "string";
|
|
const source = "string";
|
|
|
|
const res = await sdk.log.logLine(level, message, source);
|
|
|
|
if (res?.statusCode !== 200) {
|
|
throw new Error("Unexpected status code: " + res?.statusCode || "-");
|
|
}
|
|
|
|
// handle response
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description | Example |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `level` | [operations.Level](../../models/operations/level.md) | :heavy_check_mark: | An integer log level to write to the PMS log with. <br/>0: Error <br/>1: Warning <br/>2: Info <br/>3: Debug <br/>4: Verbose<br/> | |
|
|
| `message` | *string* | :heavy_check_mark: | The text of the message to write to the log. | [object Object] |
|
|
| `source` | *string* | :heavy_check_mark: | a string indicating the source of the message. | [object Object] |
|
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
|
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
|
|
|
|
|
|
### Response
|
|
|
|
**Promise<[operations.LogLineResponse](../../models/operations/loglineresponse.md)>**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| -------------------------- | -------------------------- | -------------------------- |
|
|
| errors.LogLineResponseBody | 401 | application/json |
|
|
| errors.SDKError | 4xx-5xx | */* |
|
|
|
|
## 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
|
|
|
|
```typescript
|
|
import { SDK } from "openapi";
|
|
|
|
async function run() {
|
|
const sdk = new SDK({
|
|
accessToken: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
const res = await sdk.log.logMultiLine();
|
|
|
|
if (res?.statusCode !== 200) {
|
|
throw new Error("Unexpected status code: " + res?.statusCode || "-");
|
|
}
|
|
|
|
// handle response
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
|
|
|
|
### Response
|
|
|
|
**Promise<[operations.LogMultiLineResponse](../../models/operations/logmultilineresponse.md)>**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------------- | ------------------------------- | ------------------------------- |
|
|
| errors.LogMultiLineResponseBody | 401 | application/json |
|
|
| errors.SDKError | 4xx-5xx | */* |
|
|
|
|
## 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
|
|
|
|
```typescript
|
|
import { SDK } from "openapi";
|
|
|
|
async function run() {
|
|
const sdk = new SDK({
|
|
accessToken: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
const res = await sdk.log.enablePaperTrail();
|
|
|
|
if (res?.statusCode !== 200) {
|
|
throw new Error("Unexpected status code: " + res?.statusCode || "-");
|
|
}
|
|
|
|
// handle response
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
|
|
|
|
### Response
|
|
|
|
**Promise<[operations.EnablePaperTrailResponse](../../models/operations/enablepapertrailresponse.md)>**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
|
| errors.EnablePaperTrailResponseBody | 401 | application/json |
|
|
| errors.SDKError | 4xx-5xx | */* |
|