diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-15 15:30:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-18 11:37:18 +0200 |
commit | 42b40636991b97fe818007fab19091764fc5db73 (patch) | |
tree | db431787c06ce898d22e91ff771f795219274fc6 /shared/server-commands | |
parent | 654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (diff) | |
download | PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.gz PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.zst PeerTube-42b40636991b97fe818007fab19091764fc5db73.zip |
Add ability for client to create server logs
Diffstat (limited to 'shared/server-commands')
-rw-r--r-- | shared/server-commands/logs/logs-command.ts | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/shared/server-commands/logs/logs-command.ts b/shared/server-commands/logs/logs-command.ts index 8f63383ea..1c5de7f59 100644 --- a/shared/server-commands/logs/logs-command.ts +++ b/shared/server-commands/logs/logs-command.ts | |||
@@ -1,12 +1,25 @@ | |||
1 | import { HttpStatusCode, LogLevel } from '@shared/models' | 1 | import { ClientLogCreate, HttpStatusCode, ServerLogLevel } from '@shared/models' |
2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
3 | 3 | ||
4 | export class LogsCommand extends AbstractCommand { | 4 | export class LogsCommand extends AbstractCommand { |
5 | 5 | ||
6 | createLogClient (options: OverrideCommandOptions & { payload: ClientLogCreate }) { | ||
7 | const path = '/api/v1/server/logs/client' | ||
8 | |||
9 | return this.postBodyRequest({ | ||
10 | ...options, | ||
11 | |||
12 | path, | ||
13 | fields: options.payload, | ||
14 | implicitToken: true, | ||
15 | defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 | ||
16 | }) | ||
17 | } | ||
18 | |||
6 | getLogs (options: OverrideCommandOptions & { | 19 | getLogs (options: OverrideCommandOptions & { |
7 | startDate: Date | 20 | startDate: Date |
8 | endDate?: Date | 21 | endDate?: Date |
9 | level?: LogLevel | 22 | level?: ServerLogLevel |
10 | tagsOneOf?: string[] | 23 | tagsOneOf?: string[] |
11 | }) { | 24 | }) { |
12 | const { startDate, endDate, tagsOneOf, level } = options | 25 | const { startDate, endDate, tagsOneOf, level } = options |