aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/logs
diff options
context:
space:
mode:
Diffstat (limited to 'shared/server-commands/logs')
-rw-r--r--shared/server-commands/logs/index.ts1
-rw-r--r--shared/server-commands/logs/logs-command.ts43
2 files changed, 44 insertions, 0 deletions
diff --git a/shared/server-commands/logs/index.ts b/shared/server-commands/logs/index.ts
new file mode 100644
index 000000000..69452d7f0
--- /dev/null
+++ b/shared/server-commands/logs/index.ts
@@ -0,0 +1 @@
export * from './logs-command'
diff --git a/shared/server-commands/logs/logs-command.ts b/shared/server-commands/logs/logs-command.ts
new file mode 100644
index 000000000..8f63383ea
--- /dev/null
+++ b/shared/server-commands/logs/logs-command.ts
@@ -0,0 +1,43 @@
1import { HttpStatusCode, LogLevel } from '@shared/models'
2import { AbstractCommand, OverrideCommandOptions } from '../shared'
3
4export class LogsCommand extends AbstractCommand {
5
6 getLogs (options: OverrideCommandOptions & {
7 startDate: Date
8 endDate?: Date
9 level?: LogLevel
10 tagsOneOf?: string[]
11 }) {
12 const { startDate, endDate, tagsOneOf, level } = options
13 const path = '/api/v1/server/logs'
14
15 return this.getRequestBody<any[]>({
16 ...options,
17
18 path,
19 query: { startDate, endDate, level, tagsOneOf },
20 implicitToken: true,
21 defaultExpectedStatus: HttpStatusCode.OK_200
22 })
23 }
24
25 getAuditLogs (options: OverrideCommandOptions & {
26 startDate: Date
27 endDate?: Date
28 }) {
29 const { startDate, endDate } = options
30
31 const path = '/api/v1/server/audit-logs'
32
33 return this.getRequestBody({
34 ...options,
35
36 path,
37 query: { startDate, endDate },
38 implicitToken: true,
39 defaultExpectedStatus: HttpStatusCode.OK_200
40 })
41 }
42
43}