aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/models/server/client-log-create.model.ts11
-rw-r--r--shared/models/server/client-log-level.type.ts1
-rw-r--r--shared/models/server/index.ts4
-rw-r--r--shared/models/server/log-level.type.ts1
-rw-r--r--shared/models/server/server-log-level.type.ts1
-rw-r--r--shared/server-commands/logs/logs-command.ts17
6 files changed, 31 insertions, 4 deletions
diff --git a/shared/models/server/client-log-create.model.ts b/shared/models/server/client-log-create.model.ts
new file mode 100644
index 000000000..c9dc65568
--- /dev/null
+++ b/shared/models/server/client-log-create.model.ts
@@ -0,0 +1,11 @@
1import { ClientLogLevel } from './client-log-level.type'
2
3export interface ClientLogCreate {
4 message: string
5 url: string
6 level: ClientLogLevel
7
8 stackTrace?: string
9 userAgent?: string
10 meta?: string
11}
diff --git a/shared/models/server/client-log-level.type.ts b/shared/models/server/client-log-level.type.ts
new file mode 100644
index 000000000..18dea2751
--- /dev/null
+++ b/shared/models/server/client-log-level.type.ts
@@ -0,0 +1 @@
export type ClientLogLevel = 'warn' | 'error'
diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts
index 0f7646c7a..a9136f3d4 100644
--- a/shared/models/server/index.ts
+++ b/shared/models/server/index.ts
@@ -1,14 +1,16 @@
1export * from './about.model' 1export * from './about.model'
2export * from './broadcast-message-level.type' 2export * from './broadcast-message-level.type'
3export * from './client-log-create.model'
4export * from './client-log-level.type'
3export * from './contact-form.model' 5export * from './contact-form.model'
4export * from './custom-config.model' 6export * from './custom-config.model'
5export * from './debug.model' 7export * from './debug.model'
6export * from './emailer.model' 8export * from './emailer.model'
7export * from './job.model' 9export * from './job.model'
8export * from './log-level.type'
9export * from './peertube-problem-document.model' 10export * from './peertube-problem-document.model'
10export * from './server-config.model' 11export * from './server-config.model'
11export * from './server-debug.model' 12export * from './server-debug.model'
12export * from './server-error-code.enum' 13export * from './server-error-code.enum'
13export * from './server-follow-create.model' 14export * from './server-follow-create.model'
15export * from './server-log-level.type'
14export * from './server-stats.model' 16export * from './server-stats.model'
diff --git a/shared/models/server/log-level.type.ts b/shared/models/server/log-level.type.ts
deleted file mode 100644
index 4afb92d11..000000000
--- a/shared/models/server/log-level.type.ts
+++ /dev/null
@@ -1 +0,0 @@
1export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'audit'
diff --git a/shared/models/server/server-log-level.type.ts b/shared/models/server/server-log-level.type.ts
new file mode 100644
index 000000000..f0f31a4ae
--- /dev/null
+++ b/shared/models/server/server-log-level.type.ts
@@ -0,0 +1 @@
export type ServerLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'audit'
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 @@
1import { HttpStatusCode, LogLevel } from '@shared/models' 1import { ClientLogCreate, HttpStatusCode, ServerLogLevel } from '@shared/models'
2import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
3 3
4export class LogsCommand extends AbstractCommand { 4export 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